2022-01-19 02:12:48 -05:00
|
|
|
# ---
|
|
|
|
# Stage 1: Install certs, build binary, create default config file
|
|
|
|
# ---
|
2024-02-07 13:54:28 -05:00
|
|
|
FROM --platform=$BUILDPLATFORM ghcr.io/project-zot/golang:1.21 AS builder
|
2023-10-04 11:12:56 -05:00
|
|
|
|
|
|
|
ARG TARGETOS
|
|
|
|
ARG TARGETARCH
|
2022-01-19 02:12:48 -05:00
|
|
|
ARG COMMIT
|
2023-10-04 11:12:56 -05:00
|
|
|
|
2022-01-19 02:12:48 -05:00
|
|
|
RUN mkdir -p /go/src/github.com/project-zot/zot
|
|
|
|
WORKDIR /go/src/github.com/project-zot/zot
|
|
|
|
COPY . .
|
2023-10-04 11:12:56 -05:00
|
|
|
RUN make COMMIT=$COMMIT OS=$TARGETOS ARCH=$TARGETARCH clean bench
|
2022-01-19 02:12:48 -05:00
|
|
|
|
|
|
|
# ---
|
|
|
|
# Stage 2: Final image with nothing but certs, binary, and default config file
|
|
|
|
# ---
|
2023-11-21 07:54:07 -05:00
|
|
|
FROM gcr.io/distroless/base-debian12 AS final
|
2023-10-04 11:12:56 -05:00
|
|
|
ARG TARGETOS
|
|
|
|
ARG TARGETARCH
|
|
|
|
COPY --from=builder /go/src/github.com/project-zot/zot/bin/zb-$TARGETOS-$TARGETARCH /usr/bin/zb
|
2022-01-19 02:12:48 -05:00
|
|
|
ENTRYPOINT ["/usr/bin/zb"]
|