1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
FROM golang:1.24.2-bookworm@sha256:00eccd446e023d3cd9566c25a6e6a02b90db3e1e0bbe26a48fc29cd96e800901 as build
WORKDIR /trillian
ARG GOFLAGS=""
ENV GOFLAGS=$GOFLAGS
# Download dependencies first - this should be cacheable.
COPY go.mod go.sum ./
RUN go mod download
# Now add the local Trillian repo, which typically isn't cacheable.
COPY . .
# Build the server.
RUN go install ./cmd/trillian_log_server
# Run the licensing tool and save licenses, copyright notices, etc.
RUN go run github.com/google/go-licenses/v2 save ./cmd/trillian_log_server --save_path /THIRD_PARTY_NOTICES
# Make a minimal image.
FROM gcr.io/distroless/base-debian12@sha256:27769871031f67460f1545a52dfacead6d18a9f197db77110cfc649ca2a91f44
COPY --from=build /go/bin/trillian_log_server /
COPY --from=build /THIRD_PARTY_NOTICES /THIRD_PARTY_NOTICES
ENTRYPOINT ["/trillian_log_server"]
|