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 @@ -134,6 +134,9 @@ RBAC_ROOT ?= $(MANIFEST_ROOT)/rbac
134
134
# Allow overriding the imagePullPolicy
135
135
PULL_POLICY ?= Always
136
136
137
+ # Allow overriding the GCFLAGS
138
+ GCFLAGS ?=
139
+
137
140
# Set build time variables including version details
138
141
LDFLAGS := $(shell source ./hack/version.sh; version::ldflags)
139
142
@@ -371,12 +374,12 @@ binaries: managers clusterawsadm ## Builds and installs all binaries
371
374
372
375
.PHONY : clusterawsadm
373
376
clusterawsadm : # # Build clusterawsadm binary
374
- go build -ldflags " $( LDFLAGS) " -o $(BIN_DIR ) /clusterawsadm ./cmd/clusterawsadm
377
+ go build -gcflags " $( GCFLAGS ) " - ldflags " $( LDFLAGS) " -o $(BIN_DIR ) /clusterawsadm ./cmd/clusterawsadm
375
378
376
379
377
380
.PHONY : docker-build
378
381
docker-build : docker-pull-prerequisites # # Build the docker image for controller-manager
379
- docker build --build-arg ARCH=$(ARCH ) --build-arg builder_image=$(GO_CONTAINER_IMAGE ) --build-arg LDFLAGS=" $( LDFLAGS) " . -t $(CORE_CONTROLLER_IMG ) -$(ARCH ) :$(TAG )
382
+ 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 )
380
383
381
384
.PHONY : docker-build-all # # Build all the architecture docker images
382
385
docker-build-all : $(addprefix docker-build-,$(ALL_ARCH ) )
@@ -395,7 +398,7 @@ managers: ## Alias for manager-aws-infrastructure
395
398
396
399
.PHONY : manager-aws-infrastructure
397
400
manager-aws-infrastructure : # # Build manager binary
398
- CGO_ENABLED=0 GOARCH=${ARCH} go build -ldflags " ${LDFLAGS} -extldflags '-static'" -o $(BIN_DIR ) /manager .
401
+ CGO_ENABLED=0 GOARCH=${ARCH} go build -gcflags " ${GCFLAGS} " - ldflags " ${LDFLAGS} -extldflags '-static'" -o $(BIN_DIR ) /manager .
399
402
400
403
# #@ test:
401
404
You can’t perform that action at this time.
0 commit comments