Compare commits

..

12 Commits

Author SHA1 Message Date
af0ecea9b2 Add built Docker image [skip ci] 2026-05-12 13:30:31 +00:00
ccc3927300 Add built Docker image [skip ci] 2026-05-12 12:59:24 +00:00
7293f0cff9 .drone.yml aktualisiert 2026-05-12 12:58:50 +00:00
35d63000f9 Dockerfile aktualisiert 2026-05-12 12:52:38 +00:00
1c274cf1c6 merge upstream 2026-05-12 12:13:13 +00:00
728de6a08e Dockerfile aktualisiert 2026-04-11 12:06:08 +00:00
947045c0c0 Dockerfile aktualisiert 2026-04-11 11:58:57 +00:00
df25622098 Dockerfile aktualisiert 2026-04-11 11:55:55 +00:00
8ce76dd289 Dockerfile aktualisiert 2026-04-11 11:49:14 +00:00
1e9be72276 .drone.yml aktualisiert 2026-04-11 11:41:38 +00:00
774140c867 update2 2026-04-11 13:33:48 +02:00
0efcaaa378 update 2026-04-11 13:21:41 +02:00
4 changed files with 66 additions and 25 deletions

View File

@ -42,26 +42,20 @@ steps:
- git config --global user.email "drone@ci.local" - git config --global user.email "drone@ci.local"
- git config --global user.name "Drone CI" - git config --global user.name "Drone CI"
# Remote setzen # Eigenes Repo klonen (mit Token-Auth)
#- git remote set-url origin https://git.efi.th-nuernberg.de/gitea/freudenreichan/EinfuehrungInDocker_Pipeline2 - git clone https://kesslerpe96777:$GITEA_TOKEN@git.efi.th-nuernberg.de/gitea/kesslerpe96777/EinfuehrungInDocker_Pipeline2.git
- cd EinfuehrungInDocker_Pipeline2
# Repo clonen # Branch wechseln oder neu erstellen
- git clone https://git.efi.th-nuernberg.de/gitea/freudenreichan/EinfuehrungInDocker_Pipeline2.git
- cd EinfuehrungInDocker_Pipeline
# Branch wechseln oder erstellen
- git checkout drone-artifacts || git checkout -b drone-artifacts - git checkout drone-artifacts || git checkout -b drone-artifacts
# Artifact löschen und neu hinzufügen # Altes Artifact löschen (|| true falls noch nicht da)
- git rm image.tar - git rm image.tar || true
- cp $DRONE_WORKSPACE/image.tar . - cp $DRONE_WORKSPACE/image.tar .
- git add image.tar - git add image.tar
# Commit nur wenn Änderungen vorhanden # Commit nur wenn Änderungen
- git commit -m "Add built Docker image [skip ci]" || echo "Nothing to commit" - git commit -m "Add built Docker image [skip ci]" || echo "Nothing to commit"
# Pull vor Push (um Konflikte zu vermeiden) # Push (-u beim ersten Mal damit der neue Branch upstream gesetzt wird)
- git pull || true - git push -u origin drone-artifacts
# Push
- git push

View File

@ -1,9 +1,8 @@
# Base-Image # Base-Image
FROM ubuntu:latest FROM alpine:3.23 AS builder
# Pakete installieren # Pakete installieren + Updates einspielen
RUN apt-get update RUN apk upgrade --no-cache && apk add --no-cache gcc musl-dev
RUN apt-get install -y build-essential gcc curl vim net-tools
# Arbeitsverzeichnis setzen # Arbeitsverzeichnis setzen
WORKDIR /app WORKDIR /app
@ -12,11 +11,37 @@ WORKDIR /app
COPY . . COPY . .
# Code kompilieren # Code kompilieren
RUN gcc -o deployment deployment.c RUN gcc -O2 -o deployment deployment.c
# Verzeichnis für Ausgabe anlegen
RUN mkdir /output
# Ausgabe wird ins Container-Dateisystem geschrieben # Base-Image
ENTRYPOINT ["/bin/bash", "-c"] FROM alpine:3.23
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]
# Sicherheitsupdates einspielen
RUN apk upgrade --no-cache
# Arbeitsverzeichnis setzen
WORKDIR /app
# kompiliertes Programm kopieren
COPY --from=builder /app/deployment /app/deployment
# Verzeichnis für Ausgabe anlegen + User erstellen
RUN addgroup -S appuser \
&& adduser -S appuser -G appuser \
&& mkdir /output \
&& chown -R appuser:appuser /app /output
# Datavolume für Ausgabe
VOLUME ["/output"]
# nicht als root laufen
USER appuser
# Healthcheck
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD test -s /output/output.txt || exit 1
# Ausgabe wird ins Volume geschrieben
ENTRYPOINT ["/bin/sh", "-c"]
CMD ["touch /output/output.txt && ./deployment 10 >> /output/output.txt & tail -f /output/output.txt"]

22
Dockerfile2 Normal file
View File

@ -0,0 +1,22 @@
# Base-Image
FROM ubuntu:latest
# Pakete installieren
RUN apt-get update
RUN apt-get install -y build-essential gcc curl vim net-tools
# Arbeitsverzeichnis setzen
WORKDIR /app
# alles kopieren
COPY . .
# Code kompilieren
RUN gcc -o deployment deployment.c
# Verzeichnis für Ausgabe anlegen
RUN mkdir /output
# Ausgabe wird ins Container-Dateisystem geschrieben
ENTRYPOINT ["/bin/bash", "-c"]
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]

BIN
image.tar Normal file

Binary file not shown.