Dockerfile44 lines · 1586 chars # Stage 1: builder - install dependencies and build the Electron app using npm
FROM node:lts-bookworm AS builder
# Install necessary build tools
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential python3 gcc g++ make \
libx11-dev libxkbfile-dev libsecret-1-dev libxss1 libnss3 \
libatk-bridge2.0-0 libatk1.0-0 libgtk-3-0 libasound2 \
ca-certificates curl && \
rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Copy only package.json first to install dependencies
COPY package.json ./
# Install dependencies (ignore scripts to avoid postinstall steps in this environment)
RUN npm install --ignore-scripts --legacy-peer-deps
# Copy the rest of the source code
COPY . .
# Build the project and package artifacts
RUN npm run build
RUN npm run dist
# Stage 2: runtime image
FROM debian:bookworm-slim AS runtime
# Install minimal runtime dependencies for AppImage execution
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates curl libx11-6 libxext6 libxcb1 libxrandr2 libxrender1 \
libasound2 libatk1.0-0 libatk-bridge2.0-0 libgtk-3-0 \
&& rm -rf /var/lib/apt/lists/*
# Copy packaged app from builder
COPY --from=builder /workspace/release /app
WORKDIR /app
# Entrypoint to run the AppImage if present (inline script, no external files)
ENTRYPOINT ["bash", "-lc", "APP_IMAGE=$(find /app -name '*.AppImage' 2>/dev/null | head -n1); if [ -z \"$APP_IMAGE\" ]; then echo 'No AppImage found in /app'; exit 1; fi; chmod +x \"$APP_IMAGE\" 2>/dev/null || true; exec \"$APP_IMAGE\" \"$@\""]