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

Use buildah instead of docker, support multi-arch builds #243

Merged
merged 3 commits into from
Aug 3, 2022
Merged
Changes from 2 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
35 changes: 26 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,53 @@
OPERATOR_IMAGE?=hostpath-provisioner-operator
TAG?=latest
DOCKER_REPO?=quay.io/kubevirt
GOOS?=linux
GOARCH?=amd64
BUILDAH_PLATFORM_FLAG?=--platform $(GOOS)/$(GOARCH)

export GOLANG_VER
export TAG
export GOOS
export GOARCH

all: test build

operator:
GOLANG_VER=${GOLANG_VER} ./hack/build-operator.sh
./hack/build-operator.sh

mounter:
GOLANG_VER=${GOLANG_VER} ./hack/build-mounter.sh
./hack/build-mounter.sh

csv-generator:
GOLANG_VER=${GOLANG_VER} ./hack/build-csv-generator.sh
./hack/build-csv-generator.sh

crd-generator: generate-crd
GOLANG_VER=${GOLANG_VER} ./hack/build-crd-generator.sh
./hack/build-crd-generator.sh
_out/crd-generator --sourcefile=./deploy/operator.yaml --outputDir=./tools/helper

image: operator mounter csv-generator
TAG=$(TAG) ./hack/version.sh ./_out; \
docker build -t $(DOCKER_REPO)/$(OPERATOR_IMAGE):$(TAG) -f Dockerfile .
./hack/version.sh ./_out; \
buildah build $(BUILDAH_PLATFORM_FLAG) -t $(DOCKER_REPO)/$(OPERATOR_IMAGE):$(GOARCH) -f Dockerfile .

manifest: image
-buildah manifest create $(DOCKER_REPO)/$(OPERATOR_IMAGE):local
buildah manifest add --arch $(GOARCH) $(DOCKER_REPO)/$(OPERATOR_IMAGE):local containers-storage:$(DOCKER_REPO)/$(OPERATOR_IMAGE):$(GOARCH)

push: image
docker push $(DOCKER_REPO)/$(OPERATOR_IMAGE):$(TAG)
push: clean manifest manifest-push

manifest-push:
buildah manifest push $(BUILDAH_PUSH_FLAGS) --all $(DOCKER_REPO)/$(OPERATOR_IMAGE):local docker://$(DOCKER_REPO)/$(OPERATOR_IMAGE):$(TAG)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the BUILDAH_PUSH_FLAGS set? I don't see it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, removed.


generate:
./hack/update-codegen.sh

generate-crd:
./hack/generate-crd.sh

clean:
manifest-clean:
-buildah manifest rm $(DOCKER_REPO)/$(OPERATOR_IMAGE):local

clean: manifest-clean
GO111MODULE=on; \
go mod tidy; \
go mod vendor; \
Expand Down