Michael 415e336e62
All checks were successful
continuous-integration/drone/push Build is passing
changed non root user settings
2026-04-18 21:52:02 +02:00

29 lines
1.1 KiB
Docker

# ── Stage 1: Build ───────────────────────────────────────────────────────────
FROM gcc:14-bookworm AS builder
WORKDIR /build
COPY deployment.c .
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
HEALTHCHECK --interval=30s --timeout=4s --start-period=10s --retries=3 \
CMD test -f /output/output.txt && test -s /output/output.txt || exit 1
ENTRYPOINT ["/bin/sh", "-c"]
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]