Files
godot-builder-image/build-windows.sh
Olof Pettersson 513d6efc25
All checks were successful
Publish Builder Images / build-base (push) Successful in 39s
Publish Builder Images / build-windows (push) Successful in 3m14s
Add missing env
2025-12-02 11:38:54 +01:00

61 lines
2.0 KiB
Bash

#!/bin/sh
set -e
# --- Configuration ---
BASE_IMAGE_NAME="godot-builder-base"
WIN_IMAGE_NAME="godot-builder-windows"
# We need the SAME hash logic to find the right base
BASE_HASH=$(sha256sum Dockerfile.base | cut -c 1-8)
BASE_TAG="$REGISTRY/$USERNAME/$BASE_IMAGE_NAME:$BASE_HASH"
# For the Windows image, we still use the Git SHA (passed from workflow)
# because we want a new Windows builder for every code commit.
WIN_TAG="$REGISTRY/$USERNAME/$WIN_IMAGE_NAME:$TAG"
TARBALL="llvm-mingw-20250528-ucrt-ubuntu-22.04-x86_64.tar.xz"
echo "Logging in..."
buildah login -u "$USERNAME" -p "$PASSWORD" --tls-verify=false --storage-driver=vfs "$REGISTRY"
echo "---------------------------------------"
echo "Preparing Base Image..."
echo "---------------------------------------"
# Pull the base (which build-base.sh guaranteed exists)
buildah pull --tls-verify=false --storage-driver=vfs "$BASE_TAG"
# Create the local alias so Dockerfile.windows finds it
# This satisfies: FROM godot-fedora:custom
buildah tag --storage-driver=vfs "$BASE_TAG" "godot-fedora:custom"
echo "---------------------------------------"
echo "Preparing Context..."
echo "---------------------------------------"
# Check if the file exists in the 'files/' folder (provided by actions/checkout)
if [ -f "files/$TARBALL" ]; then
echo "✅ Found local tarball in repository. Copying to build context..."
cp "files/$TARBALL" .
else
echo "❌ CRITICAL ERROR: $TARBALL not found in 'files/' directory!"
echo "Did you forget to git add/push the file?"
exit 1
fi
echo "---------------------------------------"
echo "Building Windows Image..."
echo "---------------------------------------"
buildah build \
--tls-verify=false \
--storage-driver=vfs \
--network=host \
--build-arg img_version=custom \
-f Dockerfile.windows \
-t "$WIN_TAG" \
-t "$REGISTRY/$USERNAME/$WIN_IMAGE_NAME:latest" \
.
echo "Pushing Windows image..."
buildah push --tls-verify=false --storage-driver=vfs "$WIN_TAG"
buildah push --tls-verify=false --storage-driver=vfs "$REGISTRY/$USERNAME/$WIN_IMAGE_NAME:latest"