()
| 143 | |
| 144 | // Build using Docker or Podman |
| 145 | function buildWithContainer() { |
| 146 | const runtime = containerRuntime.getRuntime(); |
| 147 | const runtimeLabel = containerRuntime.getRuntimeLabel(); |
| 148 | console.log(`Using ${runtimeLabel} for Linux build...\n`); |
| 149 | |
| 150 | // Create a temporary Dockerfile for building |
| 151 | const dockerfileContent = `# Electron 43+ V8 headers require C++20 (GCC 13+). Bookworm's GCC 12 fails to compile better-sqlite3. |
| 152 | FROM node:22-trixie-slim |
| 153 | |
| 154 | # Install build dependencies for AppImage and native modules |
| 155 | RUN apt-get update && apt-get install -y \\ |
| 156 | g++ \\ |
| 157 | make \\ |
| 158 | python3 \\ |
| 159 | libnss3 \\ |
| 160 | libatk-bridge2.0-0 \\ |
| 161 | libdrm2 \\ |
| 162 | libxkbcommon0 \\ |
| 163 | libxcomposite1 \\ |
| 164 | libxdamage1 \\ |
| 165 | libxfixes3 \\ |
| 166 | libxrandr2 \\ |
| 167 | libgbm1 \\ |
| 168 | libasound2 \\ |
| 169 | libpango-1.0-0 \\ |
| 170 | libatk1.0-0 \\ |
| 171 | libcairo-gobject2 \\ |
| 172 | libgtk-3-0 \\ |
| 173 | libgdk-pixbuf-2.0-0 \\ |
| 174 | && rm -rf /var/lib/apt/lists/* |
| 175 | |
| 176 | WORKDIR /app |
| 177 | |
| 178 | # Configure npm for better network reliability |
| 179 | RUN npm config set fetch-retries 5 && \\ |
| 180 | npm config set fetch-retry-mintimeout 20000 && \\ |
| 181 | npm config set fetch-retry-maxtimeout 120000 && \\ |
| 182 | npm config set fetch-timeout 300000 |
| 183 | |
| 184 | # Copy package files and scripts (needed for postinstall hook) |
| 185 | COPY package*.json ./ |
| 186 | COPY scripts/ ./scripts/ |
| 187 | |
| 188 | # Skip postinstall during install; rebuild native modules explicitly below |
| 189 | RUN npm install --ignore-scripts --loglevel=error || \\ |
| 190 | (sleep 5 && npm install --ignore-scripts --loglevel=error) || \\ |
| 191 | (sleep 10 && npm install --ignore-scripts --loglevel=error) && \\ |
| 192 | npm cache clean --force |
| 193 | |
| 194 | # Clean any existing native module builds to ensure fresh rebuild |
| 195 | RUN rm -rf node_modules/better-sqlite3/build || true |
| 196 | |
| 197 | # Rebuild native modules for Electron on Linux (requires GCC 13+ from trixie) |
| 198 | RUN npx @electron/rebuild --version=$(node -p 'require("electron/package.json").version') || npx electron-builder install-app-deps |
| 199 | |
| 200 | # Copy application files |
| 201 | COPY . . |
| 202 |
no test coverage detected