Compare commits

...

11 Commits
main ... main

Author SHA1 Message Date
415e336e62 changed non root user settings 2026-04-18 21:52:02 +02:00
0cab77fb37 nochmal alt 2026-04-18 20:35:27 +02:00
e7cb8709ab PAT added 2026-04-18 18:13:22 +02:00
816f56475e changes in drone 2026-04-18 18:02:50 +02:00
4cfce386df 2 step 2026-04-18 17:48:39 +02:00
98e948e360 apk update for security fix 2026-04-11 14:06:05 +02:00
ed7cef53c4 .drone.yml aktualisiert 2026-04-11 11:57:17 +00:00
2c7d8c2f60 .drone.yml aktualisiert 2026-04-11 11:55:25 +00:00
1ff64cdbad multistage 2026-04-11 13:48:44 +02:00
7dac79062f merge upstream 2026-04-11 11:46:34 +00:00
df9f066b7c changed parent image 2026-04-11 13:33:55 +02:00
3 changed files with 51 additions and 21 deletions

View File

@ -46,14 +46,15 @@ steps:
#- git remote set-url origin https://git.efi.th-nuernberg.de/gitea/freudenreichan/EinfuehrungInDocker_Pipeline2
# Repo clonen
- git clone https://git.efi.th-nuernberg.de/gitea/freudenreichan/EinfuehrungInDocker_Pipeline2.git
- cd EinfuehrungInDocker_Pipeline
- git clone https://git.efi.th-nuernberg.de/gitea/weigmi87303/EinfuehrungInDocker_Pipeline2.git
- cd EinfuehrungInDocker_Pipeline2
- git remote set-url origin https://oauth2:$GITEA_TOKEN@git.efi.th-nuernberg.de/gitea/weigmi87303/EinfuehrungInDocker_Pipeline2.git
# Branch wechseln oder erstellen
- git checkout drone-artifacts || git checkout -b drone-artifacts
# Artifact löschen und neu hinzufügen
- git rm image.tar
- git rm -f image.tar || true
- cp $DRONE_WORKSPACE/image.tar .
- git add image.tar
@ -61,7 +62,7 @@ steps:
- git commit -m "Add built Docker image [skip ci]" || echo "Nothing to commit"
# Pull vor Push (um Konflikte zu vermeiden)
- git pull || true
- git pull origin drone-artifacts || true
# Push
- git push
- git push -u origin drone-artifacts

View File

@ -1,22 +1,29 @@
# Base-Image
FROM ubuntu:latest
# ── Stage 1: Build ───────────────────────────────────────────────────────────
FROM gcc:14-bookworm AS builder
# Pakete installieren
RUN apt-get update
RUN apt-get install -y build-essential gcc curl vim net-tools
WORKDIR /build
COPY deployment.c .
# Arbeitsverzeichnis setzen
RUN gcc -O2 -static -o deployment deployment.c
# ── Stage 2: Runtime ─────────────────────────────────────────────────────────
FROM alpine:3.21
# Alle Pakete auf neuesten Stand bringen → patcht libcrypto3/libssl3 auf 3.3.7-r0
RUN apk update && apk upgrade --no-cache
# Nicht-root-User anlegen
RUN adduser -D appuser
RUN mkdir /output && chown appuser /output
USER appuser
COPY --from=builder /build/deployment /app/deployment
VOLUME [ "/output" ]
WORKDIR /app
# alles kopieren
COPY . .
HEALTHCHECK --interval=30s --timeout=4s --start-period=10s --retries=3 \
CMD test -f /output/output.txt && test -s /output/output.txt || exit 1
# 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"]
ENTRYPOINT ["/bin/sh", "-c"]
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]

22
Dockerfile-alt 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"]