#!/bin/bash set -e echo "Building pyfa binary..." # Ensure we're using the local venv if [ ! -d ".venv" ]; then echo "Creating virtual environment..." uv venv fi # Install dependencies echo "Installing dependencies..." uv pip install -r requirements.txt uv pip install pyinstaller # Clean previous builds echo "Cleaning previous builds..." rm -rf build dist # Build the binary echo "Building binary with PyInstaller..." uv run pyinstaller pyfa.spec # Sim server exe (console) into main dist folder if [ -f dist/pyfa_server/pyfa-server.exe ]; then cp dist/pyfa_server/pyfa-server.exe dist/pyfa/ fi # Docker image (Python server) DOCKER_REPO="${DOCKER_REPO:-docker.site.quack-lab.dev}" IMAGE_NAME="${IMAGE_NAME:-pyfa-server}" COMMIT_SHA=$(git rev-parse --short HEAD) IMAGE_BASE="${DOCKER_REPO}/${IMAGE_NAME}" echo "" echo "Building Docker image..." docker build -t "${IMAGE_BASE}:${COMMIT_SHA}" . docker tag "${IMAGE_BASE}:${COMMIT_SHA}" "${IMAGE_BASE}:latest" TAGS=$(git tag --points-at HEAD 2>/dev/null || true) if [ -n "$TAGS" ]; then while IFS= read -r tag; do [ -n "$tag" ] && docker tag "${IMAGE_BASE}:${COMMIT_SHA}" "${IMAGE_BASE}:${tag}" done <<< "$TAGS" fi echo "" echo "Build complete! dist/pyfa/pyfa.exe (GUI), dist/pyfa/pyfa-server.exe (POST /simulate :9123)" echo "" echo "Docker image built as:" echo " - ${IMAGE_BASE}:${COMMIT_SHA}" echo " - ${IMAGE_BASE}:latest" if [ -n "$TAGS" ]; then while IFS= read -r tag; do [ -n "$tag" ] && echo " - ${IMAGE_BASE}:${tag}" done <<< "$TAGS" fi