ARG GO_VERSION=1.24 FROM --platform=$BUILDPLATFORM golang:${GO_VERSION} AS builder WORKDIR /app COPY go.work ./ COPY go.work.sum ./ COPY ./plugins ./plugins COPY ./server ./server COPY ./edition ./edition RUN --mount=type=cache,mode=0777,target=/go/pkg/mod go mod download all ARG TARGETOS TARGETARCH RUN --mount=type=cache,mode=0777,target=/go/pkg/mod \ CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \ go build -tags timetzdata \ -o /tstor-bin ./edition RUN chmod +x /tstor-bin FROM scratch COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt COPY --from=builder /tstor-bin /tstor-bin CMD ["/tstor-bin"]