diff --git a/.gitea/workflows/build-pi.yaml b/.gitea/workflows/build-pi.yaml index a836e81..951d58b 100644 --- a/.gitea/workflows/build-pi.yaml +++ b/.gitea/workflows/build-pi.yaml @@ -15,48 +15,61 @@ jobs: - name: Build in Docker (ARM64) run: | - # Run the build inside a Python container emulating ARM64 - # We map the current directory to /app - docker run --rm --platform linux/arm64 \ - -v "${{ github.workspace }}:/app" \ - -w /app \ - python:3.11-bookworm \ - /bin/bash -c " - set -e - - # 1. Install System Dependencies required for PySide6/Qt linkage and PyInstaller - apt-get update && apt-get install -y --no-install-recommends \ - libgl1 \ - libegl1 \ - libxkbcommon-x11-0 \ - libdbus-1-3 \ - libfontconfig1 \ - binutils + # Create a Dockerfile for the build to avoid volume mount issues + cat < Dockerfile.arm64 + FROM python:3.11-bookworm + + WORKDIR /app + + # Install System Dependencies + RUN apt-get update && apt-get install -y --no-install-recommends \ + libgl1 \ + libegl1 \ + libxkbcommon-x11-0 \ + libdbus-1-3 \ + libfontconfig1 \ + binutils - # 2. Install Python Dependencies - pip install --upgrade pip + # Copy project files + COPY . /app + + # Install Python Dependencies + RUN pip install --upgrade pip && \ pip install -r requirements.txt - # 3. Run PyInstaller (Using command from build.sh) - echo 'Running PyInstaller...' - pyinstaller --name 'volvodisplay' \ + # Build with PyInstaller + RUN pyinstaller --name "volvodisplay" \ --onefile \ --windowed \ --clean \ --noconfirm \ - --add-data 'main.qml:.' \ - --add-data 'TemperatureGauge.qml:.' \ + --add-data "main.qml:." \ + --add-data "TemperatureGauge.qml:." \ --exclude-module PySide6.QtWebEngineQuick \ --exclude-module PySide6.QtWebEngineCore \ --exclude-module PySide6.QtQuick3DSpatialAudio \ main.py - - # 4. Copy config - cp config.json dist/ + + # Prepare config for export + RUN cp config.json dist/ + EOF - # 5. Fix permissions (Docker runs as root, we need to own the files to upload them) - chown -R $(id -u):$(id -g) dist - " + echo "Building Docker image..." + docker build --platform linux/arm64 -f Dockerfile.arm64 -t volvo-builder . + + echo "Extracting artifacts..." + # Create a container just to copy files out + CONTAINER_ID=$(docker create --platform linux/arm64 volvo-builder) + + # Ensure local dist directory exists + mkdir -p dist + + # Copy binary and config from the container to host + docker cp $CONTAINER_ID:/app/dist/volvodisplay dist/volvodisplay + docker cp $CONTAINER_ID:/app/dist/config.json dist/config.json + + # Cleanup + docker rm $CONTAINER_ID - name: Upload Binary uses: actions/upload-artifact@v3