zotregistry.dev/zot@v1.4.4-0.20240314164342-eec277e14d20/build/Dockerfile (about)

     1  # ---
     2  # Stage 1: Install certs, 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 binary
    14  RUN echo '{\n\
    15      "storage": {\n\
    16          "rootDirectory": "/var/lib/registry"\n\
    17      },\n\
    18      "http": {\n\
    19          "address": "0.0.0.0",\n\
    20          "port": "5000"\n\
    21      },\n\
    22      "log": {\n\
    23          "level": "debug"\n\
    24      }\n\
    25  }\n' > config.json && cat config.json
    26  
    27  # ---
    28  # Stage 2: Final image with nothing but certs, binary, and default config file
    29  # ---
    30  FROM gcr.io/distroless/base-debian12 AS final
    31  ARG TARGETOS
    32  ARG TARGETARCH
    33  COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
    34  COPY --from=builder /go/src/github.com/project-zot/zot/bin/zot-$TARGETOS-$TARGETARCH /usr/bin/zot
    35  COPY --from=builder /go/src/github.com/project-zot/zot/config.json /etc/zot/config.json
    36  ENTRYPOINT ["/usr/bin/zot"]
    37  EXPOSE 5000
    38  VOLUME ["/var/lib/registry"]
    39  CMD ["serve", "/etc/zot/config.json"]