Compare commits

..

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

View File

@ -1,42 +1,22 @@
# Aufgabe 1
FROM alpine:latest AS builder
# Base-Image
FROM ubuntu:latest
# C-Compiler + No-Cache
RUN apk add --no-cache build-base
# Pakete installieren
RUN apt-get update
RUN apt-get install -y build-essential gcc curl vim net-tools
# Arbeitsverzeichnis
# Arbeitsverzeichnis setzen
WORKDIR /app
# Code hineinkopieren
# alles kopieren
COPY . .
# Kompilieren
# Code kompilieren
RUN gcc -o deployment deployment.c
# Runtime
# Verzeichnis für Ausgabe anlegen
RUN mkdir /output
FROM alpine:latest
# Aufgabe 2.2.1 Non-Root User
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"]
# Ausgabe wird ins Container-Dateisystem geschrieben
ENTRYPOINT ["/bin/bash", "-c"]
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]