#!/bin/sh set -e # Exit on error # --- 1. CONFIGURATION --- # We read these from Environment Variables passed by the workflow # This makes the script reusable for Windows, Linux, etc. FULL_IMAGE_URL="$REGISTRY/$OWNER/$IMAGE_NAME:$IMAGE_TAG" echo "------------------------------------------------" echo "Task Runner: Starting Buildah Orchestration" echo "Target: $PLATFORM / $TARGET" echo "Image: $FULL_IMAGE_URL" echo "------------------------------------------------" # --- 2. LOGIN --- 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 --storage-driver=vfs "$REGISTRY" # --- 3. CREATE CONTAINER --- echo "Pulling image and creating working container..." # We capture the Container ID (CTR) CTR=$(buildah from --tls-verify=false --storage-driver=vfs "$FULL_IMAGE_URL") # --- 4. CONFIGURE CONTAINER --- # FIX: buildah run doesn't have --working-dir. # We use 'buildah config' to set it on the container instance instead. buildah config --storage-driver=vfs --workingdir /src "$CTR" # --- 5. EXECUTE BUILD --- echo "Running SCons inside container..." # Explaining the flags: # -v "$PWD":/src -> Mounts the host workspace (your code) into the container at /src # -w /src -> Sets working directory to /src # --env ... -> Passes variables needed strictly for the build (optional) # scons ... -> The actual compile command buildah run \ --volume "$PWD":/src \ --storage-driver=vfs \ "$CTR" \ scons platform="$PLATFORM" \ target="$TARGET" \ d3d12=no \ arch=x86_64 \ precision=double \ production="$PRODUCTION" \ use_llvm=yes \ use_mingw=yes \ -j$(nproc) # --- 6. CLEANUP --- echo "Build successful. Removing container..." buildah rm "$CTR"