#!/bin/bash
# Build CI Docker Images for BreakPilot
# Run this script on the Mac Mini to build the custom CI images

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"

echo "=== Building BreakPilot CI Images ==="
echo "Project directory: $PROJECT_DIR"

cd "$PROJECT_DIR"

# Build Python CI image with WeasyPrint
echo ""
echo "Building breakpilot/python-ci:3.12 ..."
docker build \
    -t breakpilot/python-ci:3.12 \
    -t breakpilot/python-ci:latest \
    -f .docker/python-ci.Dockerfile \
    .

echo ""
echo "=== Build complete ==="
echo ""
echo "Images built:"
docker images | grep breakpilot/python-ci

echo ""
echo "To use in Woodpecker CI, the image is already configured in .woodpecker/main.yml"
