#!/usr/bin/env bash # Build the multi-arch image and push it to the in-estate Gitea registry. # Both clusters are arm64-majority (Lounge 12/15, Nidavellir 9/12), so arm64 is # not optional. The registry credential is piped from `pass` into docker login's # stdin and never appears in a command line, an argument, or the environment. set -euo pipefail REGISTRY="git.falkvinge.net" OWNER="rick" IMAGE="forgeway" TAG="${1:-0.1.0}" PLATFORMS="linux/amd64,linux/arm64" ROOT="$(cd "$(dirname "$0")/.." && pwd)" REF="${REGISTRY}/${OWNER}/${IMAGE}" if ! docker buildx inspect forgeway-builder >/dev/null 2>&1; then docker buildx create --name forgeway-builder --driver docker-container --bootstrap fi pass git/falkvinge-pat-rwall | docker login "${REGISTRY}" --username "${OWNER}" --password-stdin docker buildx build \ --builder forgeway-builder \ --platform "${PLATFORMS}" \ --tag "${REF}:${TAG}" \ --tag "${REF}:latest" \ --push \ "${ROOT}" echo echo "pushed ${REF}:${TAG} (${PLATFORMS})" docker buildx imagetools inspect "${REF}:${TAG}" | sed -n '1,40p'