zurücksetzten

This commit is contained in:
Oliver Spies 2026-05-09 15:31:39 +00:00
parent d9b61391d9
commit 084f033c87
2 changed files with 15 additions and 35 deletions

View File

@ -64,4 +64,4 @@ steps:
- git pull || true - git pull || true
# Push # Push
- git push - git push

View File

@ -1,42 +1,22 @@
# Base-Image # Base-Image
# -------- BUILD STAGE -------- FROM ubuntu:latest
FROM gcc:13 AS builder
WORKDIR /build # Pakete installieren
COPY deployment.c . RUN apt-get update
RUN apt-get install -y build-essential gcc curl vim net-tools
RUN gcc -O2 -o deployment deployment.c
# -------- RUNTIME STAGE --------
FROM debian:bookworm-slim
# Minimal installieren
RUN apt-get update && apt-get install -y \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Non-root user erstellen
RUN useradd -m appuser
# Arbeitsverzeichnis setzen
WORKDIR /app WORKDIR /app
# Binary kopieren # alles kopieren
COPY --from=builder /build/deployment . COPY . .
# Output-Verzeichnis # Code kompilieren
RUN mkdir /output && chown appuser:appuser /output RUN gcc -o deployment deployment.c
# Rechte setzen # Verzeichnis für Ausgabe anlegen
USER appuser RUN mkdir /output
# Volume definieren # Ausgabe wird ins Container-Dateisystem geschrieben
VOLUME ["/output"] ENTRYPOINT ["/bin/bash", "-c"]
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]
# Healthcheck (prüft ob Datei existiert & nicht leer ist)
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s \
CMD test -s /output/output.txt || exit 1
# Start
ENTRYPOINT ["sh", "-c"]
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]