File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -14,9 +14,10 @@ COPY apis/go.mod apis/go.sum apis/
1414COPY hack/tools/go.mod hack/tools/go.sum hack/tools/
1515COPY pkg/hardwareutils/go.mod pkg/hardwareutils/go.sum pkg/hardwareutils/
1616RUN go mod download
17+ ARG LDFLAGS=-extldflags=-static
1718
1819COPY . .
19- RUN CGO_ENABLED=0 GO111MODULE=on go build -a -o baremetal-operator main.go
20+ RUN CGO_ENABLED=0 GO111MODULE=on go build -a -ldflags "${LDFLAGS}" - o baremetal-operator main.go
2021
2122# Copy the controller-manager into a thin image
2223# BMO has a dependency preventing us to use the static one,
Original file line number Diff line number Diff line change @@ -261,7 +261,17 @@ generate: $(CONTROLLER_GEN) ## Generate code
261261
262262.PHONY : docker
263263docker : generate manifests # # Build the docker image
264- docker build . -t ${IMG} --build-arg http_proxy=$(http_proxy ) --build-arg https_proxy=$(https_proxy )
264+ docker build . -t ${IMG} \
265+ --build-arg http_proxy=$(http_proxy ) \
266+ --build-arg https_proxy=$(https_proxy ) \
267+ --build-arg LDFLAGS=" -s -w -extldflags=-static"
268+
269+ .PHONY : docker-debug
270+ docker-debug : generate manifests # # Build the docker image with debug info
271+ docker build . -t ${IMG} \
272+ --build-arg http_proxy=$(http_proxy ) \
273+ --build-arg https_proxy=$(https_proxy ) \
274+ --build-arg LDFLAGS=" -extldflags=-static"
265275
266276# Push the docker image
267277.PHONY : docker-push
You can’t perform that action at this time.
0 commit comments