ARG bin_name=docgrouper FROM golang:1.22 as builder ARG bin_name WORKDIR /go/src/$bin_name COPY . . RUN go mod download RUN go test -v ./... && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $bin_name FROM gcr.io/distroless/base-nossl-debian12 ARG bin_name COPY --from=builder /go/src/${bin_name}/${bin_name} /bin/${bin_name} VOLUME [ "/files" ] # ARGs are stupid and cannot be used in ENTRYPOINT, so we still have to # hard-code the binary name here, but this is still better than having to # hard-code it in the stages above, since it doesn't really matter much what the # entrypoint is called. ENTRYPOINT [ "docgrouper" ]