FROM node:20-bullseye-slim
# Install dependencies required for building Electron apps
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
build-essential \
libx11-dev \
libxkbfile-dev \
libsecret-1-0 \
libnss3 \
libxss1 \
libasound2 \
libatk-bridge2.0-0 \
libgtk-3-0 \
libxcb-dri3-0 \
fonts-noto-color-emoji \
sqlite3 \
python3 \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
# Install Bun
ENV BUN_INSTALL="/root/.bun"
RUN bash -lc "curl -fsSL https://bun.sh/install | bash"
ENV PATH="/root/.bun/bin:${PATH}"
WORKDIR /app
# Copy lockfile and package manifest first for caching
COPY bun.lock bun.lockb package.json ./
# Install dependencies
RUN bun install --frozen-lockfile
# Copy the rest of the source code
COPY . .
# Build project
RUN bun run build
# Default command prints versions to verify container can start
CMD ["bash","-lc","node -v && bun -v && echo 'Build complete'"]
# Ignore common junk .git node_modules .vscode .DS_Store build dist release coverage .cache npm-debug.log yarn.lock *.log # Bun artifacts and caches (optional to ignore; dependencies are cached via Bun lockfiles) bun.lock bun.lockb
Summary of Docker build error - Exact error message and exit code - error: unzip is required to install bun - exit code: 1 - Failing command/step - [3/8] RUN bash -lc "curl -fsSL https://bun.sh/install | bash" - Missing packages or files mentioned - unzip is required to install bun (unzip package is not present in the image at the Bun install step) - Version mismatch information - Base image is node:20-bullseye-slim (sha256:890654d661f3cce510e108c21f751486ae67ff8b648ba769ada33ea56e58bfe0) with Debian bullseye. No explicit version mismatch indicated; the failure is due to a missing unzip utility rather than a version conflict. Suggested fix - Install unzip before attempting Bun install, e.g. add a line such as: - apt-get update && apt-get install -y unzip - Then re-run the Bun installation step.
FROM node:20-bullseye-slim
# Install dependencies required for building Electron apps
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
build-essential \
libx11-dev \
libxkbfile-dev \
libsecret-1-0 \
libnss3 \
libxss1 \
libasound2 \
libatk-bridge2.0-0 \
libgtk-3-0 \
libxcb-dri3-0 \
fonts-noto-color-emoji \
sqlite3 \
python3 \
python3-pip \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Install Bun
ENV BUN_INSTALL="/root/.bun"
RUN bash -lc "curl -fsSL https://bun.sh/install | bash"
ENV PATH="/root/.bun/bin:${PATH}"
WORKDIR /app
# Copy lockfile and package manifest first for caching
COPY bun.lock bun.lockb package.json ./
# Install dependencies
RUN bun install --frozen-lockfile
# Copy the rest of the source code
COPY . .
# Build project
RUN bun run build
# Default command prints versions to verify container can start
CMD ["bash","-lc","node -v && bun -v && echo 'Build complete'"]
Concerns: COPY bun.lock bun.lockb package.json ./ attempts to copy bun.lockb in addition to bun.lock. bun.lockb is not a standard Bun lock file and may not exist in the repo, causing the docker build to fail at the COPY step., bun install --frozen-lockfile relies on bun.lock being present. If bun.lock is missing or out of sync, the install will fail., If the project relies on Electron-specific build steps, ensure all required system dependencies are accounted for. The current image installs many libs, but Electron builds can require additional tweaks depending on the app.
FROM node:20-bullseye-slim
# Install dependencies required for building Electron apps
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
build-essential \
libx11-dev \
libxkbfile-dev \
libsecret-1-0 \
libnss3 \
libxss1 \
libasound2 \
libatk-bridge2.0-0 \
libgtk-3-0 \
libxcb-dri3-0 \
fonts-noto-color-emoji \
sqlite3 \
python3 \
python3-pip \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Install Bun
ENV BUN_INSTALL="/root/.bun"
RUN bash -lc "curl -fsSL https://bun.sh/install | bash"
ENV PATH="/root/.bun/bin:${PATH}"
WORKDIR /app
# Copy lockfile and package manifest first for caching
COPY bun.lock* package.json ./
# Install dependencies
RUN bun install --frozen-lockfile
# Copy the rest of the source code
COPY . .
# Build project
RUN bun run build
# Default command prints versions to verify container can start
CMD ["bash","-lc","node -v && bun -v && echo 'Build complete'"]
Failing step: - [6/8] RUN bun install --frozen-lockfile Exact error messages and exit code: - bun install v1.3.11 (af24e281) - Resolving dependencies - Resolved, downloaded and extracted [26] - warn: incorrect peer dependency "zod@3.25.76" - error: lockfile had changes, but lockfile is frozen - note: try re-running without --frozen-lockfile and commit the updated lockfile - ERROR: failed to build: failed to solve: process "/bin/sh -c bun install --frozen-lockfile" did not complete successfully: exit code: 1 Context and implications: - The failure is due to the lockfile being updated but the install was run with --frozen-lockfile, which prevents updating bun.lockfile. - Root cause is not missing packages/files, but a lockfile change that cannot be committed automatically. Version/compatibility notes: - bun version: 1.3.11 - Peer dependency warning: "zod@3.25.76" is reported as incorrect Missing packages or files mentioned: - None explicitly mentioned as missing in this error. Suggested fix: - Re-run without --frozen-lockfile to allow bun.lockfile to update, then commit the updated lockfile.
# Ignore common junk .git node_modules .vscode .DS_Store build dist release coverage .cache npm-debug.log yarn.lock *.log # Bun artifacts and caches (optional to ignore; dependencies are cached via Bun lockfiles)
- Failing step: [6/8] RUN bun install --frozen-lockfile - Exact error message and exit code: bun install v1.3.11 (af24e281) Resolving dependencies Resolved, downloaded and extracted [26] warn: incorrect peer dependency "zod@3.25.76" error: lockfile had changes, but lockfile is frozen note: try re-running without --frozen-lockfile and commit the updated lockfile exit code: 1 - Missing packages or files mentioned: None explicitly listed. The issue is a lockfile mismatch while using a frozen lockfile. - Version mismatch / related info: - Bun version: v1.3.11 - Peer dependency warning: "zod@3.25.76" - Root cause indicated: lockfile had changes, but lockfile is frozen (needs updating the lockfile and committing changes) - Suggested next step (from the log): re-run without --frozen-lockfile to update and commit the updated bun.lockfile.
FROM node:20-bullseye-slim
# Install dependencies required for building Electron apps
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
build-essential \
libx11-dev \
libxkbfile-dev \
libsecret-1-0 \
libnss3 \
libxss1 \
libasound2 \
libatk-bridge2.0-0 \
libgtk-3-0 \
libxcb-dri3-0 \
fonts-noto-color-emoji \
sqlite3 \
python3 \
python3-pip \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Install Bun
ENV BUN_INSTALL="/root/.bun"
RUN bash -lc "curl -fsSL https://bun.sh/install | bash"
ENV PATH="/root/.bun/bin:${PATH}"
WORKDIR /app
# Copy lockfile and package manifest first for caching
COPY bun.lock* package.json ./
# Install dependencies
RUN bun install
# Copy the rest of the source code
COPY . .
# Build project
RUN bun run build
# Default command prints versions to verify container can start
CMD ["bash","-lc","node -v && bun -v && echo 'Build complete'"]
Failing step - Dockerfile step [6/8] RUN bun install (Dockerfile:38) Exact error messages and exit code - Error (module not found): Cannot find module '/app/scripts/patch-electron-dev.mjs' - code: 'MODULE_NOT_FOUND' - Node.js v20.20.1 - Final bun install failure: - error: postinstall script from "21st-desktop" exited with 1 - process "/bin/sh -c bun install" did not complete successfully: exit code: 1 Missing packages/files mentioned - Missing module file: /app/scripts/patch-electron-dev.mjs Version and dependency notes - bun install version: v1.3.11 (af24e281) - Warning during install: warn: incorrect peer dependency "zod@3.25.76" - Node version in image: Node.js v20.20.1 - Base image: node:20-bullseye-slim Summary: The build fails at RUN bun install due to a missing script at /app/scripts/patch-electron-dev.mjs, causing bun's postinstall to exit with code 1. This is accompanied by Node.js v20.20.1 and bun v1.3.11, with a peer-dependency warning for zod@3.25.76.
// Patches the Electron.app bundle in node_modules to show "1Code" name and icon in macOS dock during dev mode.
import { execSync } from "child_process"
import { copyFileSync, existsSync } from "fs"
import { join, dirname } from "path"
import { fileURLToPath } from "url"
const __dirname = dirname(fileURLToPath(import.meta.url))
const root = join(__dirname, "..")
const electronApp = join(root, "node_modules/electron/dist/Electron.app")
const plistPath = join(electronApp, "Contents/Info.plist")
const icnsSource = join(root, "build/icon.icns")
const icnsDest = join(electronApp, "Contents/Resources/electron.icns")
if (process.platform !== "darwin") {
process.exit(0)
}
if (existsSync(plistPath)) {
try {
execSync(`/usr/libexec/PlistBuddy -c "Set :CFBundleName 1Code" "${plistPath}"`)
execSync(`/usr/libexec/PlistBuddy -c "Set :CFBundleDisplayName 1Code" "${plistPath}"`)
console.log("[patch-electron-dev] Updated Info.plist: name -> 1Code")
} catch (e) {
console.warn("[patch-electron-dev] Failed to update Info.plist:", e.message)
}
}
if (existsSync(icnsSource) && existsSync(icnsDest)) {
copyFileSync(icnsSource, icnsDest)
console.log("[patch-electron-dev] Replaced electron.icns with custom icon")
}
// Touch the .app bundle so macOS re-reads it
if (existsSync(electronApp)) {
execSync(`touch "${electronApp}"`)
}
FROM node:20-bullseye-slim
# Install dependencies required for building Electron apps
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
build-essential \
libx11-dev \
libxkbfile-dev \
libsecret-1-0 \
libnss3 \
libxss1 \
libasound2 \
libatk-bridge2.0-0 \
libgtk-3-0 \
libxcb-dri3-0 \
fonts-noto-color-emoji \
sqlite3 \
python3 \
python3-pip \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Install Bun
ENV BUN_INSTALL="/root/.bun"
RUN bash -lc "curl -fsSL https://bun.sh/install | bash"
ENV PATH="/root/.bun/bin:${PATH}"
WORKDIR /app
# Copy the entire repository first so all scripts exist for postinstall steps
COPY . .
# Install dependencies
RUN bun install
# Build project
RUN bun run build
# Default command prints versions to verify container can start
CMD ["bash","-lc","node -v && bun -v && echo 'Build complete'"]
Concerns: Build relies on /bin/bash being present; the base image node:20-bullseye-slim may not include bash by default. The RUN bash -lc steps will fail if bash isn't installed in the final image., Potentially large context copy: COPY . . may send the entire repo (including build artifacts or node_modules if present) to the build context. Consider adding a .dockerignore to exclude unnecessary files (e.g., node_modules, dist, logs). Smoke [PASS]: node -v Smoke [PASS]: bun -v