2021-10-15 10:05:00 -05:00
|
|
|
# ---
|
2022-01-17 09:36:13 -05:00
|
|
|
# Stage 1: Build binary, create default config file
|
2021-10-15 10:05:00 -05:00
|
|
|
# ---
|
2022-10-05 05:21:14 -05:00
|
|
|
FROM ghcr.io/project-zot/golang:1.19 AS builder
|
2022-01-24 00:19:01 -05:00
|
|
|
ARG COMMIT
|
|
|
|
ARG OS
|
|
|
|
ARG ARCH
|
2021-12-03 22:50:58 -05:00
|
|
|
RUN mkdir -p /go/src/github.com/project-zot/zot
|
|
|
|
WORKDIR /go/src/github.com/project-zot/zot
|
2021-10-15 10:05:00 -05:00
|
|
|
COPY . .
|
2022-01-24 00:19:01 -05:00
|
|
|
RUN make COMMIT=$COMMIT OS=$OS ARCH=$ARCH clean exporter-minimal
|
2021-10-15 10:05:00 -05:00
|
|
|
RUN echo '{\n\
|
|
|
|
"Server": {\n\
|
|
|
|
"protocol": "http",\n\
|
|
|
|
"host": "127.0.0.1",\n\
|
2022-01-17 09:36:13 -05:00
|
|
|
"port": "5000"\n\
|
2021-10-15 10:05:00 -05:00
|
|
|
},\n\
|
|
|
|
"Exporter": {\n\
|
2022-01-17 09:36:13 -05:00
|
|
|
"port": "5001",\n\
|
2021-10-15 10:05:00 -05:00
|
|
|
"log": {\n\
|
|
|
|
"level": "debug"\n\
|
|
|
|
}\n\
|
|
|
|
}\n\
|
|
|
|
}\n' > config.json && cat config.json
|
|
|
|
|
|
|
|
# ---
|
2022-01-17 09:36:13 -05:00
|
|
|
# Stage 2: Final image with nothing but binary and default config file
|
2021-10-15 10:05:00 -05:00
|
|
|
# ---
|
2022-02-16 17:03:03 -05:00
|
|
|
FROM gcr.io/distroless/base AS final
|
2022-02-10 16:38:37 -05:00
|
|
|
ARG OS
|
|
|
|
ARG ARCH
|
2022-01-24 00:19:01 -05:00
|
|
|
COPY --from=builder /go/src/github.com/project-zot/zot/bin/zxp-$OS-$ARCH /zxp
|
2022-01-17 09:36:13 -05:00
|
|
|
COPY --from=builder /go/src/github.com/project-zot/zot/config.json /etc/zxp/config.json
|
|
|
|
ENTRYPOINT ["/zxp"]
|
|
|
|
EXPOSE 5001
|
|
|
|
CMD ["config", "/etc/zxp/config.json"]
|