# Dockerfile for building Electron apps in Docker
# This allows building without installing dependencies on the host system

FROM node:20-bullseye

# Install dependencies for Electron and electron-builder
RUN apt-get update && apt-get install -y \
    libgtk-3-0 \
    libnotify4 \
    libnss3 \
    libxss1 \
    libxtst6 \
    xdg-utils \
    libatspi2.0-0 \
    libdrm2 \
    libgbm1 \
    libxcb-dri3-0 \
    wine \
    wine64 \
    && rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /app

# Copy package files
COPY package*.json ./

# Install dependencies
RUN npm install

# Copy project files
COPY . .

# Build the web app
RUN npm run build

# Default command (can be overridden)
CMD ["npm", "run", "electron:build"]
