Docker file best practices (#698)

(based on https://github.com/up9inc/mizu/pull/692/files)
This commit is contained in:
gadotroee 2022-01-26 15:22:52 +02:00 committed by GitHub
parent beb8363722
commit 19b4810ded
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,6 +82,9 @@ RUN go build -ldflags="-extldflags=-static -s -w \
ARG TARGETARCH=amd64 ARG TARGETARCH=amd64
FROM ${TARGETARCH}/busybox:latest FROM ${TARGETARCH}/busybox:latest
# gin-gonic runs in debug mode without this
ENV GIN_MODE=release
WORKDIR /app WORKDIR /app
# Copy binary and config files from /build to root folder of scratch container. # Copy binary and config files from /build to root folder of scratch container.
@ -89,8 +92,5 @@ COPY --from=builder ["/app/agent-build/mizuagent", "."]
COPY --from=front-end ["/app/ui-build/build", "site"] COPY --from=front-end ["/app/ui-build/build", "site"]
COPY --from=front-end ["/app/ui-build/build-ent", "site-standalone"] COPY --from=front-end ["/app/ui-build/build-ent", "site-standalone"]
# gin-gonic runs in debug mode without this
ENV GIN_MODE=release
# this script runs both apiserver and passivetapper and exits either if one of them exits, preventing a scenario where the container runs without one process # this script runs both apiserver and passivetapper and exits either if one of them exits, preventing a scenario where the container runs without one process
ENTRYPOINT "/app/mizuagent" ENTRYPOINT ["/app/mizuagent"]