File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -41,10 +41,11 @@ COPY ./ ./
41
41
ARG package=.
42
42
ARG ARCH
43
43
ARG LDFLAGS
44
+ ARG GCFLAGS
44
45
RUN --mount=type=cache,target=/root/.cache/go-build \
45
46
--mount=type=cache,target=/go/pkg/mod \
46
47
--mount=type=cache,target=/root/.local/share/golang \
47
- CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -ldflags "${LDFLAGS} -extldflags '-static'" -o manager ${package}
48
+ CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -gcflags "${GCFLAGS}" - ldflags "${LDFLAGS} -extldflags '-static'" -o manager ${package}
48
49
ENTRYPOINT [ "/start.sh" , "/workspace/manager" ]
49
50
50
51
# Copy the controller-manager into a thin image
Original file line number Diff line number Diff line change @@ -137,6 +137,9 @@ RBAC_ROOT ?= $(MANIFEST_ROOT)/rbac
137
137
# Allow overriding the imagePullPolicy
138
138
PULL_POLICY ?= Always
139
139
140
+ # Allow overriding the GCFLAGS
141
+ GCFLAGS ?=
142
+
140
143
# Set build time variables including version details
141
144
LDFLAGS := $(shell source ./hack/version.sh; version::ldflags)
142
145
@@ -387,12 +390,12 @@ binaries: managers clusterawsadm ## Builds and installs all binaries
387
390
388
391
.PHONY : clusterawsadm
389
392
clusterawsadm : # # Build clusterawsadm binary
390
- go build -ldflags " $( LDFLAGS) " -o $(BIN_DIR ) /clusterawsadm ./cmd/clusterawsadm
393
+ go build -gcflags " $( GCFLAGS ) " - ldflags " $( LDFLAGS) " -o $(BIN_DIR ) /clusterawsadm ./cmd/clusterawsadm
391
394
392
395
393
396
.PHONY : docker-build
394
397
docker-build : docker-pull-prerequisites # # Build the docker image for controller-manager
395
- docker build --build-arg ARCH=$(ARCH ) --build-arg builder_image=$(GO_CONTAINER_IMAGE ) --build-arg LDFLAGS=" $( LDFLAGS) " . -t $(CORE_CONTROLLER_IMG ) -$(ARCH ) :$(TAG )
398
+ docker build --build-arg ARCH=$(ARCH ) --build-arg builder_image=$(GO_CONTAINER_IMAGE ) --build-arg GCFLAGS= " $( GCFLAGS ) " --build-arg LDFLAGS=" $( LDFLAGS) " . -t $(CORE_CONTROLLER_IMG ) -$(ARCH ) :$(TAG )
396
399
397
400
.PHONY : docker-build-all # # Build all the architecture docker images
398
401
docker-build-all : $(addprefix docker-build-,$(ALL_ARCH ) )
@@ -411,7 +414,7 @@ managers: ## Alias for manager-aws-infrastructure
411
414
412
415
.PHONY : manager-aws-infrastructure
413
416
manager-aws-infrastructure : # # Build manager binary
414
- CGO_ENABLED=0 GOARCH=${ARCH} go build -ldflags " ${LDFLAGS} -extldflags '-static'" -o $(BIN_DIR ) /manager .
417
+ CGO_ENABLED=0 GOARCH=${ARCH} go build -gcflags " ${GCFLAGS} " - ldflags " ${LDFLAGS} -extldflags '-static'" -o $(BIN_DIR ) /manager .
415
418
416
419
# #@ test:
417
420
You can’t perform that action at this time.
0 commit comments