This commit is contained in:
parent
ed7cef53c4
commit
98e948e360
10
Dockerfile
10
Dockerfile
@ -4,30 +4,26 @@ FROM gcc:14-bookworm AS builder
|
||||
WORKDIR /build
|
||||
COPY deployment.c .
|
||||
|
||||
# Statisch linken → kein libc im Runtime-Image nötig
|
||||
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 addgroup -S appgroup && adduser -S appuser -G appgroup
|
||||
|
||||
# Output-Verzeichnis mit korrekten Rechten anlegen
|
||||
RUN mkdir /output && chown appuser:appgroup /output
|
||||
|
||||
# Kompiliertes Binary aus Build-Stage kopieren
|
||||
COPY --from=builder /build/deployment /app/deployment
|
||||
|
||||
# Volume für Ausgabe-Dateien
|
||||
VOLUME ["/output"]
|
||||
|
||||
# Als nicht-root laufen
|
||||
USER appuser
|
||||
WORKDIR /app
|
||||
|
||||
# Healthcheck: prüft ob das Binary vorhanden und ausführbar ist,
|
||||
# und ob die Ausgabedatei wächst / existiert
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||
CMD test -f /output/output.txt && test -s /output/output.txt || exit 1
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user