From 3c2fa9c9d135d69604b2a4fd66e4bd1254cccb8a Mon Sep 17 00:00:00 2001 From: Kinan Allamaa Date: Tue, 21 Apr 2026 13:07:37 +0000 Subject: [PATCH] Dockerfile aktualisiert --- Dockerfile | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index e51f8ae..afc8bd7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,29 @@ -# Stage 1: Bauen (mit Alpine + gcc) -FROM alpine:3.19 AS build-env +# Base-Image +#FROM ubuntu:latest +# Pakete installieren +#RUN apt-get update && apt-get install -y build-essential gcc curl vim net-tools + +# Stage 1: Bauen (mit Alpine + gcc) +FROM alpine:3.21 AS build-env + +# Pakete installieren RUN apk add --no-cache gcc musl-dev +# Arbeitsverzeichnis setzen WORKDIR /app + +# alles kopieren --> nur noch deployment.c kopieren! COPY deployment.c . + +# Code kompilieren RUN gcc -o deployment deployment.c # Stage 2: Schlankes Runtime-Image -FROM alpine:3.19 +FROM alpine:3.21 -# Output-Verzeichnis erstellen -RUN mkdir -p /output +# Verzeichnis für Ausgabe anlegen +RUN mkdir /output # Nicht-Root-User anlegen RUN addgroup -S appgroup && adduser -S appuser -G appgroup @@ -30,5 +42,6 @@ USER appuser 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"] \ 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"] \ No newline at end of file