From 084f033c87c49c49be7d043b83e0edb10bd488e1 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sat, 9 May 2026 15:31:39 +0000 Subject: [PATCH] =?UTF-8?q?zur=C3=BCcksetzten?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .drone.yml | 2 +- Dockerfile | 48 ++++++++++++++---------------------------------- 2 files changed, 15 insertions(+), 35 deletions(-) diff --git a/.drone.yml b/.drone.yml index 4622934..476ef9b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -64,4 +64,4 @@ steps: - git pull || true # Push - - git push \ No newline at end of file + - git push diff --git a/Dockerfile b/Dockerfile index 586c88b..d962f94 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,42 +1,22 @@ # Base-Image -# -------- BUILD STAGE -------- -FROM gcc:13 AS builder +FROM ubuntu:latest -WORKDIR /build -COPY deployment.c . - -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 +# Pakete installieren +RUN apt-get update +RUN apt-get install -y build-essential gcc curl vim net-tools +# Arbeitsverzeichnis setzen WORKDIR /app -# Binary kopieren -COPY --from=builder /build/deployment . +# alles kopieren +COPY . . -# Output-Verzeichnis -RUN mkdir /output && chown appuser:appuser /output +# Code kompilieren +RUN gcc -o deployment deployment.c -# Rechte setzen -USER appuser +# Verzeichnis für Ausgabe anlegen +RUN mkdir /output -# Volume definieren -VOLUME ["/output"] - -# 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"] \ No newline at end of file +# Ausgabe wird ins Container-Dateisystem geschrieben +ENTRYPOINT ["/bin/bash", "-c"] +CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]