Compare commits

...

13 Commits
main ... main

Author SHA1 Message Date
19dad46519 .drone.yml aktualisiert
last try
2026-04-12 09:08:23 +00:00
a873f0fd75 .drone.yml aktualisiert
forgot to rename at one place
2026-04-12 08:52:46 +00:00
f482c548d5 .drone.yml aktualisiert
rename
2026-04-12 08:47:19 +00:00
f20149a448 .drone.yml aktualisiert
Added Token
2026-04-12 08:46:15 +00:00
6702274d0f .drone.yml aktualisiert
git push update to include info if theres no branch yet
2026-04-11 21:16:30 +00:00
c674a12f9e added image.tar file to pass last ci check 2026-04-11 21:08:42 +00:00
ac7628e92c .drone.yml aktualisiert
Änderung für neue pipeline2 bennenung
2026-04-11 20:54:41 +00:00
65f7568d94 changed to secure focused wolf image 2026-04-11 20:49:05 +00:00
fd7cd93357 newer alpine version 2026-04-11 19:59:09 +00:00
db3dfa6b4e swicht from debian-slim to alpine because of CI Vulnerabilities 2026-04-11 19:55:18 +00:00
7aed6a2669 Build error fix at dockerfile 2026-04-11 13:09:33 +00:00
1bfd977d6f Dockerfile changed according to task 2026-04-11 12:54:20 +00:00
10fbaaaf8f .drone.yml aktualisiert
den Pfad zum clonen in push artifact richtig gesetzt
2026-04-11 11:57:50 +00:00
3 changed files with 51 additions and 16 deletions

View File

@ -46,8 +46,8 @@ steps:
#- git remote set-url origin https://git.efi.th-nuernberg.de/gitea/freudenreichan/EinfuehrungInDocker_Pipeline2 #- git remote set-url origin https://git.efi.th-nuernberg.de/gitea/freudenreichan/EinfuehrungInDocker_Pipeline2
# Repo clonen # Repo clonen
- git clone https://git.efi.th-nuernberg.de/gitea/freudenreichan/EinfuehrungInDocker_Pipeline2.git - git clone https://oauth2:${GITEA_TOKEN}@git.efi.th-nuernberg.de/gitea/meyerjo94774/EinfuehrungInDocker_Pipeline2.git
- cd EinfuehrungInDocker_Pipeline - cd EinfuehrungInDocker_Pipeline2
# Branch wechseln oder erstellen # Branch wechseln oder erstellen
- git checkout drone-artifacts || git checkout -b drone-artifacts - git checkout drone-artifacts || git checkout -b drone-artifacts
@ -64,4 +64,4 @@ steps:
- git pull || true - git pull || true
# Push # Push
- git push - git push --set-upstream origin drone-artifacts

View File

@ -1,22 +1,57 @@
# Base-Image # Multi-Stage Build
FROM ubuntu:latest
# Pakete installieren # ============================================
RUN apt-get update # Build Stage
RUN apt-get install -y build-essential gcc curl vim net-tools # ============================================
FROM cgr.dev/chainguard/wolfi-base:latest AS build
# Arbeitsverzeichnis setzen # Nur die benötigten Pakete installieren mit --no-chache
RUN apk add --no-cache build-base
# WORKDIR setzen
WORKDIR /app WORKDIR /app
# alles kopieren # Source Code kopieren
COPY . . COPY . .
# Code kompilieren # Compile
RUN gcc -o deployment deployment.c RUN gcc -o deployment deployment.c
# Verzeichnis für Ausgabe anlegen # ============================================
RUN mkdir /output # Runtime Stage
# ============================================
FROM cgr.dev/chainguard/wolfi-base:latest AS runtime
# Ausgabe wird ins Container-Dateisystem geschrieben # Curl für den HEALTHCHECK
ENTRYPOINT ["/bin/bash", "-c"] RUN apk add --no-cache curl
# Das output directory erstellen
RUN mkdir -p /output
# User ohne Root-Rechte erstellen
RUN adduser -D app
# Der User app braucht die Rechte für den Ordner output
RUN chown -R app:app /output
# Das Binary aus der Build-Stage kopieren
COPY --from=build /app/deployment /app/deployment
# WORKDIR setzen
WORKDIR /app
#output als Mount angeben
VOLUME ["/output"]
# Auf den app User wechseln
USER app
# Programm starten
ENTRYPOINT ["/bin/sh", "-c"]
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"] CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]
# prüfen ob output.txt existiert und aktualisiert wird
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD [ -f /output/output.txt ] && \
[ $(find /output/output.txt -mmin -1 | wc -l) -gt 0 ] || exit 1

BIN
image.tar Normal file

Binary file not shown.