#!/bin/sh set -e # --- Configuration --- FULL_IMAGE_URL="$REGISTRY/$OWNER/godot-builder-$BUILDER_TYPE:$IMAGE_TAG" echo "------------------------------------------------" echo "Starting Build for: $PLATFORM / $TARGET" echo "Using Builder: $FULL_IMAGE_URL" echo "------------------------------------------------" echo "Logging into registry..." # Note: We use --password-stdin for security so the secret isn't in process list echo "$PASSWORD" | buildah login -u "$USERNAME" --password-stdin --tls-verify=false "$REGISTRY" echo "Pulling image and creating working container..." # We capture the Container ID (CTR) CTR=$(buildah from --tls-verify=false "$FULL_IMAGE_URL") # 3. Clean up on exit (Trap) cleanup() { echo "Cleaning up container..." buildah rm "$CTR" || true } trap cleanup EXIT # 4. Determine SCons Flags based on Platform # Windows needs LLVM/MinGW flags. Linux just needs defaults. SCONS_FLAGS="platform=$PLATFORM target=$TARGET arch=x86_64 precision=double production=$PRODUCTION -j$(nproc)" if [ "$PLATFORM" = "windows" ]; then # Add Windows-specific flags (LLVM toolchain, disable D3D12) SCONS_FLAGS="$SCONS_FLAGS use_llvm=yes use_mingw=yes d3d12=no" fi # We use 'buildah config' to set it on the container instance instead. buildah config --workingdir /src "$CTR" echo "Running: scons $SCONS_FLAGS" # 5. Run Build buildah run \ --volume "$PWD":/src \ "$CTR" \ scons $SCONS_FLAGS echo "✅ Build Complete"