Skip to content

Commit 7149263

Browse files
committed
Fix DWARF
Signed-off-by: smoshiur1237 <moshiur.rahman@est.tech>
1 parent cebcf63 commit 7149263

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ COPY ./ ./
3636
# Build
3737
ARG package=.
3838
ARG ARCH
39-
ARG ldflags=-s -w -extldflags=-static
39+
ARG ldflags
4040

4141
# Do not force rebuild of up-to-date packages (do not use -a) and use the compiler cache folder
4242
RUN --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}" \
45+
go build -ldflags "${ldflags} -extldflags '-static'" \
4646
-o manager ${package}
4747

4848
# Production image

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,17 +402,18 @@ generate-api-docs-%: $(GEN_CRD_API_REFERENCE_DOCS) FORCE
402402
## --------------------------------------
403403

404404
.PHONY: docker-build
405-
docker-build: ## Build the docker image for controller-manager
405+
docker-build: ## Build the docker image for controller-manager without debug info
406406
docker build -f Dockerfile --build-arg GO_VERSION=$(GO_VERSION) \
407407
--build-arg goproxy=$(GOPROXY) \
408-
--build-arg ARCH=$(ARCH) . -t $(CONTROLLER_IMG_TAG)
408+
--build-arg ARCH=$(ARCH) \
409+
--build-arg ldflags="$(LDFLAGS) -s -w" . -t $(CONTROLLER_IMG_TAG)
409410

410411
.PHONY: docker-build-debug
411412
docker-build-debug: ## Build the docker image for controller-manager with debug info
412413
docker build -f Dockerfile --build-arg GO_VERSION=$(GO_VERSION) \
413414
--build-arg goproxy=$(GOPROXY) \
414415
--build-arg ARCH=$(ARCH) \
415-
--build-arg ldflags="-extldflags=-static" . -t $(CONTROLLER_IMG_TAG)
416+
--build-arg ldflags="$(LDFLAGS)" . -t $(CONTROLLER_IMG_TAG)
416417

417418
.PHONY: docker-push
418419
docker-push: ## Push the docker image

0 commit comments

Comments
 (0)