forked from freudenreichan/EinfuehrungInDocker_Pipeline2
This commit is contained in:
parent
1ed3106b5f
commit
75e72bbb1d
12
Dockerfile
12
Dockerfile
@ -1,5 +1,4 @@
|
||||
|
||||
FROM alpine:3.19 AS build
|
||||
FROM alpine:3.21 AS build
|
||||
|
||||
RUN apk add --no-cache gcc musl-dev
|
||||
|
||||
@ -7,28 +6,21 @@ WORKDIR /app
|
||||
COPY . .
|
||||
RUN gcc -o deployment deployment.c
|
||||
|
||||
# Final-Stage
|
||||
FROM alpine:3.19
|
||||
|
||||
FROM alpine:3.21
|
||||
|
||||
RUN adduser -D -u 1000 appuser
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
RUN mkdir /output && chown appuser:appuser /output
|
||||
|
||||
|
||||
COPY --from=build /app/deployment .
|
||||
RUN chown appuser:appuser ./deployment
|
||||
|
||||
# Volume deklarieren → Drone/Docker kann es mounten
|
||||
VOLUME ["/output"]
|
||||
|
||||
# Als non-root laufen
|
||||
USER appuser
|
||||
|
||||
# Healthcheck: prüft ob Output geschrieben wurde
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||
CMD test -f /output/output.txt || exit 1
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user