diff --git a/Dockerfile b/Dockerfile index a5cdf64..7fbca0b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,17 @@ -# Base-Image -FROM ubuntu:latest - -# Pakete installieren -RUN apt-get update -RUN apt-get install -y build-essential gcc curl vim net-tools - -# Arbeitsverzeichnis setzen +# BUILDER STAGE +FROM alpine:3.20 AS builder +RUN apk add --no-cache build-base WORKDIR /app - -# alles kopieren -COPY . . - -# Code kompilieren +COPY deployment.c . +# Wir bauen hier noch "normal" RUN gcc -o deployment deployment.c -# Verzeichnis für Ausgabe anlegen +# RUNTIME STAGE +FROM alpine:3.20 +WORKDIR /app +COPY --from=builder /app/deployment . RUN mkdir /output -# Ausgabe wird ins Container-Dateisystem geschrieben -ENTRYPOINT ["/bin/bash", "-c"] +# Wir nutzen sh (Standard in Alpine), da bash extra installiert werden müsste +ENTRYPOINT ["/bin/sh", "-c"] CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"] \ No newline at end of file