# Base-Image (Bleibt Alpine 3.15 für deine Aufgabe)
FROM alpine:3.23.3

# Pakete installieren (Hier lag der Fehler: apk statt apt-get)
# 'build-base' ist das Alpine-Äquivalent zu 'build-essential'
RUN apk add --no-cache \
    build-base \
    gcc \
    curl \
    vim \
    net-tools \
    bash

# Arbeitsverzeichnis setzen
WORKDIR /app

# alles kopieren
COPY . .

# Code kompilieren
RUN gcc -o deployment deployment.c

# Verzeichnis für Ausgabe anlegen
RUN mkdir /output

# Wichtig: Alpine hat standardmäßig keine bash, daher oben mit installiert
ENTRYPOINT ["/bin/bash", "-c"]
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]