forked from freudenreichan/EinfuehrungInDocker_Pipeline2
This commit is contained in:
parent
14a87720a8
commit
70302b28c7
15
Dockerfile
15
Dockerfile
@ -36,20 +36,15 @@ COPY --from=builder --chown=1000:1000 /build/deployment /app/
|
|||||||
# 3. Ab hier läuft alles als sicherer Non-Root User
|
# 3. Ab hier läuft alles als sicherer Non-Root User
|
||||||
USER 1000
|
USER 1000
|
||||||
|
|
||||||
# 4. Data Volume für die Ausgabe mounten
|
# 4. Data Volume für die Ausgabe mounten (um lokal die output.txt zu sehen)
|
||||||
VOLUME ["/output"]
|
VOLUME ["/output"]
|
||||||
|
|
||||||
# 5. Healthcheck implementieren
|
# 5. Healthcheck
|
||||||
# Da das C-Programm alle 10 Sekunden etwas schreibt, prüfen wir alle 15 Sekunden,
|
# Da das C-Programm alle 10 Sekunden etwas schreibt, prüfen wir alle 15 Sekunden,
|
||||||
# ob die Datei "/output/ausgabe.log" existiert und Daten enthält (-s).
|
# ob die Datei "/output/output.txt" existiert und Daten enthält (-s).
|
||||||
# HEALTHCHECK --interval=15s --timeout=3s --start-period=5s --retries=3 \
|
HEALTHCHECK --interval=15s --timeout=3s --start-period=5s --retries=3 \
|
||||||
# CMD test -s /output/ausgabe.log || exit 1
|
CMD test -s /output/output.txt || exit 1
|
||||||
|
|
||||||
# 6. Startbefehl
|
# 6. Startbefehl
|
||||||
# Wir starten das Programm (Intervall: 10 Sekunden) und hängen die Ausgabe (>>) an die Datei im Volume an.
|
|
||||||
# (Dein C-Code nutzt netterweise schon fflush(stdout), was perfekt für diese Umleitung ist!)
|
|
||||||
# CMD ["sh", "-c", "./deployment 10 >> /output/ausgabe.log && tail -f /output/ausgabe.log"]
|
|
||||||
|
|
||||||
# Ausgabe wird ins Container-Dateisystem geschrieben
|
|
||||||
ENTRYPOINT ["/bin/sh", "-c"]
|
ENTRYPOINT ["/bin/sh", "-c"]
|
||||||
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]
|
CMD ["./deployment 10 > /output/output.txt && tail -f /output/output.txt"]
|
||||||
Loading…
x
Reference in New Issue
Block a user