Skip to content

Commit

Permalink
Merge pull request #219 from tylercreller/build-push-mac
Browse files Browse the repository at this point in the history
Add make target for cross arch image build/push
  • Loading branch information
tonytheleg authored Nov 6, 2024
2 parents d26e8cc + d45af7a commit 924cd82
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions build_push_minimal.sh
Original file line number Diff line number Diff line change
@@ -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}"

0 comments on commit 924cd82

Please sign in to comment.