nochmal alt
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Michael Weig 2026-04-18 20:35:27 +02:00
parent e7cb8709ab
commit 0cab77fb37

View File

@ -1,31 +1,22 @@
# ── Stage 1: Build ───────────────────────────────────────────────────────────
FROM gcc:14-bookworm AS builder
# Base-Image
FROM ubuntu:latest
WORKDIR /build
COPY deployment.c .
# Pakete installieren
RUN apt-get update
RUN apt-get install -y build-essential gcc curl vim net-tools
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
COPY --from=builder /build/deployment /app/deployment
VOLUME ["/output"]
USER appuser
# Arbeitsverzeichnis setzen
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
# alles kopieren
COPY . .
ENTRYPOINT ["/bin/sh", "-c"]
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]
# 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"]