File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -36,13 +36,13 @@ COPY ./ ./
3636# Build
3737ARG package=.
3838ARG ARCH
39- ARG ldflags=-s -w -extldflags=-static
39+ ARG ldflags
4040
4141# Do not force rebuild of up-to-date packages (do not use -a) and use the compiler cache folder
4242RUN --mount=type=cache,target=/root/.cache/go-build \
4343 --mount=type=cache,target=/go/pkg/mod \
4444 CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} \
45- go build -ldflags "${ldflags}" \
45+ go build -ldflags "${ldflags} -extldflags '-static' " \
4646 -o manager ${package}
4747
4848# Production image
Original file line number Diff line number Diff line change @@ -402,17 +402,18 @@ generate-api-docs-%: $(GEN_CRD_API_REFERENCE_DOCS) FORCE
402402# # --------------------------------------
403403
404404.PHONY : docker-build
405- docker-build : # # Build the docker image for controller-manager
405+ docker-build : # # Build the docker image for controller-manager without debug info
406406 docker build -f Dockerfile --build-arg GO_VERSION=$(GO_VERSION ) \
407407 --build-arg goproxy=$(GOPROXY ) \
408- --build-arg ARCH=$(ARCH ) . -t $(CONTROLLER_IMG_TAG )
408+ --build-arg ARCH=$(ARCH ) \
409+ --build-arg ldflags=" $( LDFLAGS) -s -w" . -t $(CONTROLLER_IMG_TAG )
409410
410411.PHONY : docker-build-debug
411412docker-build-debug : # # Build the docker image for controller-manager with debug info
412413 docker build -f Dockerfile --build-arg GO_VERSION=$(GO_VERSION ) \
413414 --build-arg goproxy=$(GOPROXY ) \
414415 --build-arg ARCH=$(ARCH ) \
415- --build-arg ldflags=" -extldflags=-static " . -t $(CONTROLLER_IMG_TAG )
416+ --build-arg ldflags=" $( LDFLAGS ) " . -t $(CONTROLLER_IMG_TAG )
416417
417418.PHONY : docker-push
418419docker-push : # # Push the docker image
You can’t perform that action at this time.
0 commit comments