zotregistry.dev/zot@v1.4.4-0.20240314164342-eec277e14d20/build/Dockerfile-zxp (about) 1 # --- 2 # Stage 1: Build binary, create default config file 3 # --- 4 FROM --platform=$BUILDPLATFORM ghcr.io/project-zot/golang:1.21 AS builder 5 6 ARG TARGETOS 7 ARG TARGETARCH 8 ARG COMMIT 9 10 RUN mkdir -p /go/src/github.com/project-zot/zot 11 WORKDIR /go/src/github.com/project-zot/zot 12 COPY . . 13 RUN make COMMIT=$COMMIT OS=$TARGETOS ARCH=$TARGETARCH clean exporter-minimal 14 RUN echo '{\n\ 15 "Server": {\n\ 16 "protocol": "http",\n\ 17 "host": "127.0.0.1",\n\ 18 "port": "5000"\n\ 19 },\n\ 20 "Exporter": {\n\ 21 "port": "5001",\n\ 22 "log": {\n\ 23 "level": "debug"\n\ 24 }\n\ 25 }\n\ 26 }\n' > config.json && cat config.json 27 28 # --- 29 # Stage 2: Final image with nothing but binary and default config file 30 # --- 31 FROM gcr.io/distroless/base-debian12 AS final 32 ARG TARGETOS 33 ARG TARGETARCH 34 COPY --from=builder /go/src/github.com/project-zot/zot/bin/zxp-$TARGETOS-$TARGETARCH /zxp 35 COPY --from=builder /go/src/github.com/project-zot/zot/config.json /etc/zxp/config.json 36 ENTRYPOINT ["/zxp"] 37 EXPOSE 5001 38 CMD ["config", "/etc/zxp/config.json"]