feat(linux): bundle Python CLI and fix Electron packaged build
- contrib/linux/Dockerfile: add libpython3.11 + PyInstaller to build standalone cli binary; fix venv isolation via .dockerignore - frontend/electron/main.cjs: use bundled cli binary in prod via process.resourcesPath, fallback to venv/python3 in dev - frontend/package.json: add extraResources for cli binary, set output dir to release/ - frontend/vite.config.js: set base './' for file:// protocol in prod - .dockerignore: exclude venv/, node_modules/, dist/, .git/ - .gitignore: ignore release/ output directories
This commit is contained in:
31
contrib/linux/Dockerfile
Normal file
31
contrib/linux/Dockerfile
Normal file
@@ -0,0 +1,31 @@
|
||||
FROM node:22.14.0-bookworm
|
||||
|
||||
# System dependencies
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
python3 python3-pip python3-venv libpython3.11 \
|
||||
binutils \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Copy repo
|
||||
COPY . .
|
||||
|
||||
# Python venv + dependencies
|
||||
RUN python3 -m venv venv && \
|
||||
venv/bin/pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Compile Python CLI into a standalone binary
|
||||
RUN venv/bin/pip install --no-cache-dir pyinstaller && \
|
||||
venv/bin/pyinstaller --onefile --name cli src/cli.py && \
|
||||
mkdir -p frontend/resources && \
|
||||
cp dist/cli frontend/resources/cli
|
||||
|
||||
# JS dependencies + electron-builder
|
||||
RUN cd frontend && npm ci && npm install --no-save electron-builder
|
||||
|
||||
# Build
|
||||
RUN cd frontend && npx vite build && npx electron-builder --linux AppImage --publish never
|
||||
|
||||
# Export AppImage
|
||||
CMD cp frontend/release/*.AppImage /out/
|
||||
Reference in New Issue
Block a user