forked from freudenreichan/EinfuehrungInDocker_Pipeline2
Dockerfile aktualisiert
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
This commit is contained in:
parent
b80bc08728
commit
0836d0ef0f
35
Dockerfile
35
Dockerfile
@ -1,22 +1,29 @@
|
|||||||
# Base-Image
|
FROM alpine:3.21 AS builder
|
||||||
FROM alpine:3.21
|
|
||||||
|
|
||||||
# Pakete installieren
|
RUN apk add --no-cache build-base
|
||||||
RUN apt-get update
|
|
||||||
RUN apt-get install -y build-essential gcc curl vim net-tools
|
|
||||||
|
|
||||||
# Arbeitsverzeichnis setzen
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# alles kopieren
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Code kompilieren
|
|
||||||
RUN gcc -o deployment deployment.c
|
RUN gcc -o deployment deployment.c
|
||||||
|
|
||||||
# Verzeichnis für Ausgabe anlegen
|
FROM alpine:3.21
|
||||||
RUN mkdir /output
|
|
||||||
|
|
||||||
# Ausgabe wird ins Container-Dateisystem geschrieben
|
RUN addgroup -g 1000 appgroup && \
|
||||||
ENTRYPOINT ["/bin/bash", "-c"]
|
adduser -D -u 1000 -G appgroup appuser
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY --from=builder /app/deployment /app/deployment
|
||||||
|
|
||||||
|
RUN mkdir /output && \
|
||||||
|
chown -R appuser:appgroup /app /output
|
||||||
|
|
||||||
|
USER appuser
|
||||||
|
|
||||||
|
VOLUME /output
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||||
|
CMD ps | grep -q '[d]eployment' || exit 1
|
||||||
|
|
||||||
|
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