forked from freudenreichan/EinfuehrungInDocker_Pipeline2
27 lines
637 B
Docker
27 lines
637 B
Docker
# Base-Image
|
|
FROM alpine3.20 AS build-env
|
|
|
|
# Pakete installieren
|
|
RUN apt-get update
|
|
RUN apt-get install --no-cache -y build-essential gcc curl vim net-tools
|
|
|
|
# Arbeitsverzeichnis setzen
|
|
WORKDIR /app
|
|
|
|
# alles kopieren
|
|
COPY . .
|
|
|
|
# Code kompilieren
|
|
RUN gcc -o deployment deployment.c
|
|
|
|
# Verzeichnis für Ausgabe anlegen
|
|
RUN mkdir /output
|
|
|
|
USER appuser
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
CMD curl -f http://localhost:8080/health || exit 1
|
|
|
|
# Ausgabe wird ins Container-Dateisystem geschrieben
|
|
ENTRYPOINT ["/bin/bash", "-c"]
|
|
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"] |