Skip to content

Commit

Permalink
Do not use go.work inside build container
Browse files Browse the repository at this point in the history
When the golang version does not match the version used inside
the build container, dowloading the modules can fail with:

~~~
go: go.work requires go >= 1.21.13 (running go 1.21.11; GOTOOLCHAIN=local)
~~~

This PR makes sure the go.work file created outside gets removed
after the source was copied into the build container.

Signed-off-by: Martin Schuppert <[email protected]>
  • Loading branch information
stuggi committed Sep 17, 2024
1 parent 3f800fb commit 55c89c2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ WORKDIR $REMOTE_SOURCE_DIR/$REMOTE_SOURCE_SUBDIR
USER root
RUN mkdir -p ${DEST_ROOT}/usr/local/bin/

RUN if [ ! -f $CACHITO_ENV_FILE ]; then go mod download ; fi
RUN if [ ! -f $CACHITO_ENV_FILE ]; then rm -f go.work go.work.sum; go mod download ; fi

# Build manager
RUN if [ -f $CACHITO_ENV_FILE ] ; then source $CACHITO_ENV_FILE ; fi ; env ${GO_BUILD_EXTRA_ENV_ARGS} go build ${GO_BUILD_EXTRA_ARGS} -a -o ${DEST_ROOT}/manager main.go
Expand Down

0 comments on commit 55c89c2

Please sign in to comment.