File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
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
39+ ARG ldflags=-s -w -extldflags=-static
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} -extldflags '-static' " \
45+ go build -ldflags "${ldflags}" \
4646 -o manager ${package}
4747
4848# Production image
Original file line number Diff line number Diff line change @@ -340,7 +340,16 @@ generate-api-docs-%: $(GEN_CRD_API_REFERENCE_DOCS) FORCE
340340
341341.PHONY : docker-build
342342docker-build : # # Build the docker image for controller-manager
343- docker build -f Dockerfile --build-arg GO_VERSION=$(GO_VERSION ) --build-arg goproxy=$(GOPROXY ) --build-arg ARCH=$(ARCH ) --build-arg ldflags=" $( LDFLAGS) " . -t $(CONTROLLER_IMG_TAG )
343+ docker build -f Dockerfile --build-arg GO_VERSION=$(GO_VERSION ) \
344+ --build-arg goproxy=$(GOPROXY ) \
345+ --build-arg ARCH=$(ARCH ) . -t $(CONTROLLER_IMG_TAG )
346+
347+ .PHONY : docker-build-debug
348+ docker-build-debug : # # Build the docker image for controller-manager with debug info
349+ docker build -f Dockerfile --build-arg GO_VERSION=$(GO_VERSION ) \
350+ --build-arg goproxy=$(GOPROXY ) \
351+ --build-arg ARCH=$(ARCH ) \
352+ --build-arg ldflags=" -extldflags=-static" . -t $(CONTROLLER_IMG_TAG )
344353
345354.PHONY : docker-push
346355docker-push : # # Push the docker image
You can’t perform that action at this time.
0 commit comments