Compare commits

..

No commits in common. "main" and "main" have entirely different histories.
main ... main

View File

@ -1,42 +1,22 @@
# Aufgabe 1 # Base-Image
FROM alpine:latest AS builder FROM ubuntu:latest
# C-Compiler + No-Cache # Pakete installieren
RUN apk add --no-cache build-base RUN apt-get update
RUN apt-get install -y build-essential gcc curl vim net-tools
# Arbeitsverzeichnis # Arbeitsverzeichnis setzen
WORKDIR /app WORKDIR /app
# Code hineinkopieren # alles kopieren
COPY . . COPY . .
# Kompilieren # Code kompilieren
RUN gcc -o deployment deployment.c RUN gcc -o deployment deployment.c
# Runtime # Verzeichnis für Ausgabe anlegen
RUN mkdir /output
FROM alpine:latest # Ausgabe wird ins Container-Dateisystem geschrieben
ENTRYPOINT ["/bin/bash", "-c"]
# Aufgabe 2.2.1 Non-Root User CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
# Arbeitsverzeichnis
WORKDIR /app
COPY --from=builder /app/deployment .
# User Rechte
RUN mkdir /output && chown appuser:appgroup /output
# Aufgabe 2.2.2 Container als normaler User
USER appuser
# Aufgabe 5 Datavolume mounten
VOLUME ["/output"]
# Aufgabe 6 Healthcheck
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
CMD test -f /output/output.txt || exit 1
# Startbefehl
CMD ["sh", "-c", "./deployment 10 > /output/output.txt && tail -f /output/output.txt"]