Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Multi-Arch Images 📦 #732

Merged
merged 2 commits into from
Jul 11, 2022
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
23 changes: 5 additions & 18 deletions .ci/build
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,8 @@ cd "${SOURCE_PATH}"

###############################################################################

# If no LOCAL_BUILD environment variable is set, we configure the `go build` command
# to build for linux OS, amd64 architectures and without CGO enablement.
if [[ -z "$LOCAL_BUILD" ]]; then
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build \
-a \
-v \
-mod=vendor \
-o "${BINARY_PATH}/rel/machine-controller-manager" \
cmd/machine-controller-manager/controller_manager.go

# If the LOCAL_BUILD environment variable is set, we simply run `go build`.
else
GO111MODULE=on go build \
-v \
-mod=vendor \
-o "${BINARY_PATH}/machine-controller-manager" \
cmd/machine-controller-manager/controller_manager.go
fi
CGO_ENABLED=0 GO111MODULE=on go build \
-v \
-mod=vendor \
-o "${BINARY_PATH}/machine-controller-manager" \
cmd/machine-controller-manager/controller_manager.go
4 changes: 4 additions & 0 deletions .ci/pipeline_definitions
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ machine-controller-manager:
'inject-commit-hash'
inject_effective_version: true
publish:
oci-builder: docker-buildx
platforms:
- linux/amd64
- linux/arm64
dockerimages:
timuthy marked this conversation as resolved.
Show resolved Hide resolved
machine-controller-manager:
inputs:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ WORKDIR /
############# machine-controller-manager #############
FROM base AS machine-controller-manager

COPY --from=builder /go/src/github.com/gardener/machine-controller-manager/bin/rel/machine-controller-manager /machine-controller-manager
COPY --from=builder /go/src/github.com/gardener/machine-controller-manager/bin/machine-controller-manager /machine-controller-manager
ENTRYPOINT ["/machine-controller-manager"]
13 changes: 1 addition & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,8 @@ revendor:
build:
@.ci/build

.PHONY: build-local
build-local:
@env LOCAL_BUILD=1 .ci/build

.PHONY: release
release: build build-local docker-image docker-login docker-push rename-binaries
release: build docker-image docker-login docker-push

.PHONY: docker-image
docker-image:
Expand All @@ -115,16 +111,9 @@ docker-push:
@if ! docker images $(IMAGE_REPOSITORY) | awk '{ print $$2 }' | grep -q -F $(IMAGE_TAG); then echo "$(IMAGE_REPOSITORY) version $(IMAGE_TAG) is not yet built. Please run 'make docker-images'"; false; fi
@gcloud docker -- push $(IMAGE_REPOSITORY):$(IMAGE_TAG)

.PHONY: rename-binaries
rename-binaries:
@if [[ -f bin/machine-controller-manager ]]; then cp bin/machine-controller-manager machine-controller-manager-darwin-amd64; fi
@if [[ -f bin/rel/machine-controller-manager ]]; then cp bin/rel/machine-controller-manager machine-controller-manager-linux-amd64; fi

.PHONY: clean
clean:
@rm -rf bin/
@rm -f *linux-amd64
@rm -f *darwin-amd64

#####################################################################
# Rules for verification, formatting, linting, testing and cleaning #
Expand Down