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 ./ ./
36
36
# Build
37
37
ARG package=.
38
38
ARG ARCH
39
- ARG ldflags
39
+ ARG ldflags=-s -w -extldflags=-static
40
40
41
41
# Do not force rebuild of up-to-date packages (do not use -a) and use the compiler cache folder
42
42
RUN --mount=type=cache,target=/root/.cache/go-build \
43
43
--mount=type=cache,target=/go/pkg/mod \
44
44
CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} \
45
- go build -ldflags "${ldflags} -extldflags '-static' " \
45
+ go build -ldflags "${ldflags}" \
46
46
-o manager ${package}
47
47
48
48
# 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
340
340
341
341
.PHONY : docker-build
342
342
docker-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 )
344
353
345
354
.PHONY : docker-push
346
355
docker-push : # # Push the docker image
You can’t perform that action at this time.
0 commit comments