forked from freudenreichan/EinfuehrungInDocker_Pipeline2
30 lines
604 B
Docker
30 lines
604 B
Docker
FROM alpine:3.20 AS builder
|
|
|
|
RUN apk add --no-cache build-base
|
|
|
|
WORKDIR /app
|
|
COPY deployment.c .
|
|
|
|
RUN gcc -O2 -o deployment deployment.c
|
|
|
|
|
|
FROM alpine:3.20
|
|
|
|
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /app/deployment /app/deployment
|
|
|
|
RUN mkdir -p /output && chown -R appuser:appgroup /app /output
|
|
|
|
USER appuser
|
|
|
|
VOLUME ["/output"]
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
CMD test -f /output/output.txt || exit 1
|
|
|
|
ENTRYPOINT ["/bin/sh", "-c"]
|
|
CMD ["./deployment 10 >> /output/output.txt && tail -f /output/output.txt"]
|