Kinan Allamaa 90ac8902e6
Some checks failed
continuous-integration/drone/push Build is failing
Dockerfile aktualisiert
2026-04-21 12:57:41 +00:00

34 lines
858 B
Docker

# Stage 1: Bauen (mit Alpine + gcc)
FROM alpine:3.19 AS build-env
RUN apk add --no-cache gcc musl-dev
WORKDIR /app
COPY deployment.c .
RUN gcc -o deployment deployment.c
# Stage 2: Schlankes Runtime-Image
FROM alpine:3.19
# Output-Verzeichnis erstellen
RUN mkdir -p /output
# Nicht-Root-User anlegen
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
RUN chown appuser:appgroup /output
# Nur die fertige Binary aus Stage 1 übernehmen
COPY --from=build-env /app/deployment /app/deployment
# Volume für Ausgabe
VOLUME ["/output"]
# Non-root User setzen
USER appuser
# Healthcheck: prüft ob das Output-Verzeichnis erreichbar ist
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
CMD test -d /output || exit 1
ENTRYPOINT ["/bin/sh", "-c"]
CMD ["./app/deployment 10 > /output/output.txt && tail -f /output/output.txt"]