# Build container for Electron-based Desktop App (Linux packaging)
FROM node:slim
# Install system dependencies required for building Electron apps
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends build-essential python3 \
&& rm -rf /var/lib/apt/lists/*
# Set working directory for the build
WORKDIR /workspace
# Copy npm manifest first to leverage Docker cache
COPY package.json package-lock.json* ./
# Install dependencies using npm ci for reproducible builds
RUN npm ci
# Copy the rest of the source code
COPY . .
# Build the project for Linux (x64) using the provided npm script
RUN npm run package:linux
# Run the packaged Linux binary by default (auto-detect path for robustness)
# The build outputs to /workspace/out/*-linux-x64/electron-api-demos
CMD ["sh","-lc","set -e; APP_DIR=$(ls -1 /workspace/out | grep -E 'linux-x64$' | head -n1); if [ -z \"$APP_DIR\" ]; then echo 'Could not locate linux-x64 build dir in /workspace/out'; ls -la /workspace/out; exit 1; fi; exec /workspace/out/$APP_DIR/electron-api-demos"]
node_modules/ dist/ out/ .git/ .gitignore *.log *.lock *.tmp .DS_Store .cache .netlify/ .vscode/ coverage/ .env
node_modules/ dist/ out/ .git/ .gitignore *.log *.lock *.tmp .DS_Store .cache .vscode/ coverage/ .env
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
# Build container for Electron-based Desktop App (Linux packaging)
FROM node:slim
# Install system dependencies required for building Electron apps
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends build-essential python3 \
&& rm -rf /var/lib/apt/lists/*
# Set working directory for the build
WORKDIR /workspace
# Copy npm manifest first to leverage Docker cache
COPY package.json package-lock.json* ./
# Install dependencies using npm ci for reproducible builds
RUN npm ci
# Copy the rest of the source code
COPY . .
# Build the project for Linux (x64) using the provided npm script
RUN npm run package:linux
# Run the packaged Linux binary by default (headless execution is not guaranteed in CI)
# The build outputs to /workspace/out/*-linux-x64/<app-folder>
CMD ["bash","-lc","set -e; echo 'Packaged Linux artifacts are located under /workspace/out'; if [ -d /workspace/out/linux-x64 ]; then echo 'Contents of linux-x64:'; ls -la /workspace/out/linux-x64; fi; exec /bin/bash"]
# Build container for Electron-based Desktop App (Linux packaging)
FROM node:slim
# Install system dependencies required for building Electron apps
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends build-essential python3 \
&& rm -rf /var/lib/apt/lists/*
# Set working directory for the build
WORKDIR /workspace
# Copy npm manifest first to leverage Docker cache
COPY package.json package-lock.json* ./
# Install dependencies using npm ci for reproducible builds
RUN npm ci
# Copy the rest of the source code
COPY . .
# Build the project for Linux (x64) using the provided npm script
RUN npm run package:linux
# Run the packaged Linux binary by default (headless execution is not guaranteed in CI)
# The build outputs to /workspace/out/*-linux-x64/<app-folder>
CMD ["bash","-lc","set -e; echo 'Packaged Linux artifacts are located under /workspace/out'; if [ -d /workspace/out/linux-x64 ]; then echo 'Contents of linux-x64:'; ls -la /workspace/out/linux-x64; fi; exec /bin/bash"]
# syntax=docker/dockerfile:1
FROM node:slim AS builder
WORKDIR /app
# Install build dependencies
RUN apt-get update -y && \
apt-get install -y --no-install-recommends build-essential python3 ca-certificates && \
rm -rf /var/lib/apt/lists/*
# Install dependencies
COPY package.json package-lock.json ./
RUN npm ci
# Copy source and build
COPY . .
# Build Linux package
RUN npm run package:linux
# Runtime image
FROM debian:bookworm-slim AS runtime
# Install runtime dependencies for Electron apps
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
ca-certificates \
fontconfig \
libasound2 \
libatk1.0-0 \
libatk-1.0-0 \
libxcb1 \
libxcb-dri3-0 \
libx11-6 \
libx11-xcb1 \
libxss1 \
libgtk-3-0 \
libnss3 \
libgbm1 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Copy built output from builder
COPY --from=builder /app/out /app/out
# Launcher script to run the packaged app regardless of folder name
RUN mkdir -p /usr/local/bin && \
printf '#!/bin/sh\nset -e\nAPP_ROOT="/app/out"\nAPP_DIR=$(ls -1 "$APP_ROOT" | head -n 1)\nEXEC=$(ls -1 "$APP_ROOT/$APP_DIR" | head -n 1)\nexec "$APP_ROOT/$APP_DIR/$EXEC" "$@"\n' > /usr/local/bin/run-app.sh && \
chmod +x /usr/local/bin/run-app.sh
WORKDIR /app/out
CMD ["/bin/sh","-lc","/usr/local/bin/run-app.sh"]
# Containers **/.DS_Store **/Thumbs.db # Version control .git .gitignore # Dependencies node_modules/ dist/ out/ build/ coverage/ .env # Logs *.log *.log.* # Misc *.tmp *.bak **/*.swp **/*.swo