From d45af7af5e6a4b2e1f60d44662535942d35087b9 Mon Sep 17 00:00:00 2001 From: Tyler Creller Date: Wed, 6 Nov 2024 08:48:01 -0500 Subject: [PATCH] Add make target for cross arch image build/push --- Makefile | 4 ++++ README.md | 8 ++++++++ build_push_minimal.sh | 16 ++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100755 build_push_minimal.sh diff --git a/Makefile b/Makefile index fdabdc74..1d062bd5 100644 --- a/Makefile +++ b/Makefile @@ -69,6 +69,10 @@ build: docker-build-push: ./build_deploy.sh +.PHONY: build-push-minimal +build-push-minimal: + ./build_push_minimal.sh + .PHONY: clean # removes all binaries clean: diff --git a/README.md b/README.md index d8e87593..d3a23162 100644 --- a/README.md +++ b/README.md @@ -218,6 +218,14 @@ export IMAGE=your-quay-repo # if desired make docker-build-push ``` +### Build Container Images (macOS) +This is an alternative to the above command for macOS users, but should work for any arch +```shell +export QUAY_REPO_INVENTORY=your-quay-repo # required +podman login quay.io # required, this target assumes you are already logged in +make build-push-minimal +``` + ## Example Usage All these examples use the REST API and assume we are running the default local version diff --git a/build_push_minimal.sh b/build_push_minimal.sh new file mode 100755 index 00000000..6e2826a4 --- /dev/null +++ b/build_push_minimal.sh @@ -0,0 +1,16 @@ +# Publish inventory images to your personal quay.io repository +# Compatible with MacOS and other archs for cross-compilation +# Excludes redhat.registry.io as this is not needed for local/ephem development +set -exv + +if [[ -z "$QUAY_REPO_INVENTORY" ]]; then + # required since this script is not used in the CI pipeline, publishing should + # only happen from a developer's local machine to their personal repo + echo "QUAY_REPO_INVENTORY must be set" + exit 1 +fi +IMAGE_TAG=$(git rev-parse --short=7 HEAD) + +source ./scripts/check_docker_podman.sh +${DOCKER} build --platform linux/amd64 --build-arg TARGETARCH=amd64 -t "${QUAY_REPO_INVENTORY}:${IMAGE_TAG}" -f ./Dockerfile +${DOCKER} push "${QUAY_REPO_INVENTORY}:${IMAGE_TAG}"