#!/usr/bin/env bash # Builds the hacked build-image (hacked-build-image/Dockerfile) locally, tagged with # hacked-build-image/VERSION and :latest. Does not push - test it with # ./hacked-build-run-image.sh first, then publish with # ./hacked-build-upload-image.sh. set -euo pipefail cd "$(dirname "${BASH_SOURCE[0]}")" ROOT="$(pwd)" fail() { echo "PREFLIGHT FAIL: $*" >&2; exit 1; } command -v docker >/dev/null 2>&1 \ || fail "docker not found in PATH" IMAGE="${HACKED_REGISTRY_IMAGE:-questshock/hacked-builder}" if [ -f "$ROOT/../registry.env" ]; then # shellcheck disable=SC1091 source "$ROOT/../registry.env" IMAGE="${HACKED_REGISTRY_IMAGE:-$IMAGE}" fi VERSION="$(<"$ROOT/hacked-build-image/VERSION")" [ -n "$VERSION" ] || fail "hacked-build-image/VERSION is empty" echo "== Building $IMAGE:$VERSION ==" docker build \ -f "$ROOT/hacked-build-image/Dockerfile" \ -t "$IMAGE:$VERSION" \ -t "$IMAGE:latest" \ "$ROOT" echo "== Done ==" echo "Image: $IMAGE:$VERSION (and :latest)" echo "Test it with ./hacked-build-run-image.sh, then publish with ./hacked-build-upload-image.sh"