Skip to content

Commit

Permalink
Merge pull request #804 from macedogm/v2.10-vex-go-build-improvements
Browse files Browse the repository at this point in the history
[v2.10] VEX related improvements in the build process
  • Loading branch information
yiannistri authored Jan 9, 2025
2 parents 042b818 + 2682cba commit 31e42fe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ $(SETUP_ENVTEST):

.PHONY: operator
operator:
CGO_ENABLED=0 go build -o bin/aks-operator main.go
CGO_ENABLED=0 go build -ldflags \
"-X github.com/rancher/aks-operator/pkg/version.GitCommit=$(GIT_COMMIT) \
-X github.com/rancher/aks-operator/pkg/version.Version=$(TAG)" \
-o bin/aks-operator .

.PHONY: generate-go
generate-go: $(MOCKGEN)
Expand Down Expand Up @@ -139,7 +142,7 @@ buildx-machine: ## create rancher dockerbuildx machine targeting platform define
.PHONY: image-build
image-build: buildx-machine ## build (and load) the container image targeting the current platform.
docker buildx build -f package/Dockerfile \
--builder $(MACHINE) --build-arg VERSION=$(TAG) \
--builder $(MACHINE) --build-arg COMMIT=$(GIT_COMMIT) --build-arg VERSION=$(TAG) \
-t "$(IMAGE)" $(BUILD_ACTION) .
@echo "Built $(IMAGE)"

Expand Down
8 changes: 7 additions & 1 deletion package/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ COPY ./main.go ./main.go
COPY --from=xx / /

ARG TARGETPLATFORM
ARG COMMIT
ARG VERSION
ENV CGO_ENABLED=0
RUN xx-go build -o /aks-operator && xx-verify /aks-operator
RUN xx-go build -ldflags \
"-X github.com/rancher/aks-operator/pkg/version.GitCommit=${COMMIT} \
-X github.com/rancher/aks-operator/pkg/version.Version=${VERSION}" \
-o /aks-operator && \
xx-verify /aks-operator

FROM registry.suse.com/bci/bci-micro:15.6
COPY --from=base /etc/passwd /etc/passwd
Expand Down

0 comments on commit 31e42fe

Please sign in to comment.