Compare commits

..

2 Commits

Author SHA1 Message Date
1a2e510912 Add built Docker image [skip ci] 2026-05-10 14:42:27 +00:00
071e005a11 Add built Docker image [skip ci] 2026-05-10 14:31:21 +00:00
2 changed files with 25 additions and 5 deletions

View File

@ -2,7 +2,7 @@
FROM alpine:latest AS build FROM alpine:latest AS build
# Pakete installieren # Pakete installieren
RUN apk add --no-cache build-base gcc curl vim net-tools RUN apk add --no-cache build-base
# Arbeitsverzeichnis setzen # Arbeitsverzeichnis setzen
WORKDIR /app WORKDIR /app
@ -13,10 +13,30 @@ COPY . .
# Code kompilieren # Code kompilieren
RUN gcc -o deployment deployment.c RUN gcc -o deployment deployment.c
# ---------- Runtime Stage ----------
FROM alpine:latest
# Arbeitsverzeichnis setzen
WORKDIR /app
# Benutzer ohne root-Rechte anlegen
RUN adduser -D appuser
# kompiliertes Programm kopieren
COPY --from=build /app/deployment .
# Verzeichnis für Ausgabe anlegen # Verzeichnis für Ausgabe anlegen
RUN mkdir /output RUN mkdir /output && chown appuser /output
# Ausgabe wird ins Container-Dateisystem geschrieben # Datavolume definieren
ENTRYPOINT ["/bin/sh", "-c"] VOLUME ["/output"]
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]
# Benutzer wechseln
USER appuser
# HEALTHCHECK
HEALTHCHECK CMD test -f /app/deployment || exit 1
# Ausgabe wird ins Datavolume geschrieben
CMD ["sh", "-c", "./deployment 10 > /output/output.txt && tail -f /output/output.txt"]

BIN
image.tar Normal file

Binary file not shown.