Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ COPY ./ ./
# Build
ARG package=.
ARG ARCH
ARG ldflags
ARG ldflags=-s -w -extldflags=-static

# Do not force rebuild of up-to-date packages (do not use -a) and use the compiler cache folder
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} \
go build -ldflags "${ldflags} -extldflags '-static'" \
go build -ldflags "${ldflags}" \
-o manager ${package}

# Production image
Expand Down
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,16 @@ generate-api-docs-%: $(GEN_CRD_API_REFERENCE_DOCS) FORCE

.PHONY: docker-build
docker-build: ## Build the docker image for controller-manager
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)
docker build -f Dockerfile --build-arg GO_VERSION=$(GO_VERSION) \
--build-arg goproxy=$(GOPROXY) \
--build-arg ARCH=$(ARCH) . -t $(CONTROLLER_IMG_TAG)

.PHONY: docker-build-debug
docker-build-debug: ## Build the docker image for controller-manager with debug info
docker build -f Dockerfile --build-arg GO_VERSION=$(GO_VERSION) \
--build-arg goproxy=$(GOPROXY) \
--build-arg ARCH=$(ARCH) \
--build-arg ldflags="-extldflags=-static" . -t $(CONTROLLER_IMG_TAG)

.PHONY: docker-push
docker-push: ## Push the docker image
Expand Down