ci: switch to docker build to fix volume mount issues
All checks were successful
Build Raspberry Pi Binary / build-arm64 (push) Successful in 12m49s
All checks were successful
Build Raspberry Pi Binary / build-arm64 (push) Successful in 12m49s
This commit is contained in:
@@ -15,48 +15,61 @@ 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 \
|
WORKDIR /app
|
||||||
python:3.11-bookworm \
|
|
||||||
/bin/bash -c "
|
# Install System Dependencies
|
||||||
set -e
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
libgl1 \
|
||||||
# 1. Install System Dependencies required for PySide6/Qt linkage and PyInstaller
|
libegl1 \
|
||||||
apt-get update && apt-get install -y --no-install-recommends \
|
libxkbcommon-x11-0 \
|
||||||
libgl1 \
|
libdbus-1-3 \
|
||||||
libegl1 \
|
libfontconfig1 \
|
||||||
libxkbcommon-x11-0 \
|
binutils
|
||||||
libdbus-1-3 \
|
|
||||||
libfontconfig1 \
|
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user