ci: switch to docker build to fix volume mount issues
All checks were successful
Build Raspberry Pi Binary / build-arm64 (push) Successful in 12m49s

This commit is contained in:
2026-01-14 15:13:36 +01:00
parent e6a981e11e
commit 9ba548ccd0

View File

@@ -15,17 +15,14 @@ jobs:
- name: Build in Docker (ARM64) - name: Build in Docker (ARM64)
run: | run: |
# Run the build inside a Python container emulating ARM64 # Create a Dockerfile for the build to avoid volume mount issues
# We map the current directory to /app cat <<EOF > Dockerfile.arm64
docker run --rm --platform linux/arm64 \ FROM python:3.11-bookworm
-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 WORKDIR /app
apt-get update && apt-get install -y --no-install-recommends \
# Install System Dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1 \ libgl1 \
libegl1 \ libegl1 \
libxkbcommon-x11-0 \ libxkbcommon-x11-0 \
@@ -33,30 +30,46 @@ jobs:
libfontconfig1 \ libfontconfig1 \
binutils binutils
# 2. Install Python Dependencies # Copy project files
pip install --upgrade pip COPY . /app
# Install Python Dependencies
RUN pip install --upgrade pip && \
pip install -r requirements.txt pip install -r requirements.txt
# 3. Run PyInstaller (Using command from build.sh) # Build with PyInstaller
echo 'Running PyInstaller...' RUN pyinstaller --name "volvodisplay" \
pyinstaller --name 'volvodisplay' \
--onefile \ --onefile \
--windowed \ --windowed \
--clean \ --clean \
--noconfirm \ --noconfirm \
--add-data 'main.qml:.' \ --add-data "main.qml:." \
--add-data 'TemperatureGauge.qml:.' \ --add-data "TemperatureGauge.qml:." \
--exclude-module PySide6.QtWebEngineQuick \ --exclude-module PySide6.QtWebEngineQuick \
--exclude-module PySide6.QtWebEngineCore \ --exclude-module PySide6.QtWebEngineCore \
--exclude-module PySide6.QtQuick3DSpatialAudio \ --exclude-module PySide6.QtQuick3DSpatialAudio \
main.py main.py
# 4. Copy config # Prepare config for export
cp config.json dist/ RUN cp config.json dist/
EOF
# 5. Fix permissions (Docker runs as root, we need to own the files to upload them) echo "Building Docker image..."
chown -R $(id -u):$(id -g) dist 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 - name: Upload Binary
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3