forked from freudenreichan/EinfuehrungInDocker_Pipeline2
This commit is contained in:
parent
3855a269bf
commit
3eba9b606c
34
Dockerfile
34
Dockerfile
@ -1,27 +1,21 @@
|
||||
FROM alpine:latest
|
||||
FROM alpine:3.19 AS builder
|
||||
RUN apk add --no-cache gcc musl-dev
|
||||
WORKDIR /app
|
||||
COPY deployment.c .
|
||||
RUN gcc -static -O2 -s -o deployment deployment.c && strip deployment
|
||||
|
||||
RUN apk add --no-cache build-base && \
|
||||
rm -rf /var/cache/apk/*
|
||||
FROM alpine:3.19
|
||||
RUN apk add --no-cache bash coreutils && rm -rf /var/cache/apk/*
|
||||
RUN addgroup -g 1000 appuser && adduser -u 1000 -G appuser -s /bin/bash -D appuser
|
||||
RUN mkdir -p /app /output && chown -R appuser:appuser /app /output
|
||||
|
||||
RUN addgroup -S -g 10001 appgroup && \
|
||||
adduser -S -u 10001 -G appgroup -h /app -s /bin/sh appuser
|
||||
COPY --from=builder --chown=appuser:appuser /app/deployment /app/
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --chown=appuser:appgroup . .
|
||||
|
||||
USER appuser
|
||||
RUN gcc -o deployment deployment.c -O2 -static
|
||||
|
||||
USER root
|
||||
|
||||
RUN mkdir -p /output && \
|
||||
chown -R appuser:appgroup /output && \
|
||||
chmod -R 755 /output
|
||||
|
||||
VOLUME ["/output"]
|
||||
|
||||
USER appuser
|
||||
|
||||
ENTRYPOINT ["/bin/sh", "-c"]
|
||||
CMD ["./deployment 10 > /output/output.txt 2>&1 && exec tail -f /output/output.txt"]
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
CMD test -f /output/output.txt || exit 1
|
||||
|
||||
CMD ["/bin/bash", "-c", "./deployment 10 > /output/output.txt && tail -f /output/output.txt"]
|
||||
Loading…
x
Reference in New Issue
Block a user