When `go install` is called, go tries to get the git commit hash and embed it into the built binary. Internally, go just calls the git executable. The newer go-toolset seems to be based on RHEL 9.2 that ships a newer version of git (2.39.1). This version contains the safe directory patch that disallows git from operating on repositories owned by different users. Thus, we need to chown the files when copying. See https://git-scm.com/docs/git-config/2.35.2#Documentation/git-config.txt-safedirectory Signed-off-by: Ondřej Budai <ondrej@budai.cz>
14 lines
710 B
Text
14 lines
710 B
Text
FROM registry.access.redhat.com/ubi9/go-toolset:latest AS builder
|
|
# ubi9/go-toolset defaults to uid 1001. Let's copy the files with this UID as well.
|
|
# Otherwise, VCS stamping will fail because git >= 2.35.2 refuses to work in
|
|
# a repository owned by a different user.
|
|
COPY --chown=1001 . .
|
|
ENV GOFLAGS=-mod=vendor
|
|
RUN go install ./cmd/osbuild-service-maintenance/
|
|
|
|
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
|
|
RUN mkdir -p "/usr/libexec/osbuild-composer"
|
|
RUN mkdir -p "/etc/osbuild-composer/"
|
|
COPY --from=builder /opt/app-root/src/go/bin/osbuild-service-maintenance /usr/libexec/osbuild-composer/osbuild-service-maintenance
|
|
ENTRYPOINT ["/usr/libexec/osbuild-composer/osbuild-service-maintenance"]
|
|
|