Dockerfile aktualisiert
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Aaron Voelker 2026-05-17 16:18:04 +00:00
parent f3629abddf
commit 78c168f9de

View File

@ -1,41 +1,34 @@
# -----------------------
# 1. BUILD STAGE
# -----------------------
FROM alpine:latest AS builder
FROM alpine:3.20
# gcc installieren
RUN apk add --no-cache gcc musl-dev
# Arbeitsverzeichnis
WORKDIR /app
# Dateien kopieren
COPY deployment.c .
# Programm kompilieren
RUN gcc -O2 -o deployment deployment.c
# -----------------------
# 2. RUNTIME STAGE
# -----------------------
FROM alpine:latest
# Sicherheitsuser anlegen
# Non-root User
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
WORKDIR /app
# nur Binary übernehmen
COPY --from=builder /app/deployment /app/deployment
# Output-Verzeichnis
RUN mkdir /output && chown -R appuser:appgroup /output /app
# Non-root User
USER appuser
# Volume für Ausgabe
# Datavolume
VOLUME ["/output"]
# Healthcheck (angepasst an dein Programm)
# Falls es nur einmal läuft: alternative prüfen (siehe Hinweis unten)
HEALTHCHECK --interval=30s --timeout=3s \
CMD test -f /output/output.txt || exit 1
# User wechseln
USER appuser
# Healthcheck
HEALTHCHECK CMD test -f /output/output.txt || exit 1
# Anwendung starten
CMD ["/bin/sh", "-c", "./deployment 10 > /output/output.txt"]
# Start
CMD ["/app/deployment", "10"]