FROM golang:alpine3.21 AS build ENV CGO_ENABLED=1 RUN apk add --no-cache gcc musl-dev WORKDIR /workspace COPY go.mod /workspace/ COPY go.sum /workspace/ RUN go mod download COPY main.go /workspace/ ENV GOCACHE=/root/.cache/go-build RUN --mount=type=cache,target="/root/.cache/go-build" go install -ldflags='-s -w -extldflags "-static"' ./main.go FROM scratch COPY --from=build /go/bin/main /usr/local/bin/didadmin COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ ENTRYPOINT [ "/usr/local/bin/didadmin" ]