# Multi-stage Dockerfile to build Folo desktop from source and provide a runnable AppImage (if produced) or a shell fallback. FROM node:20-bullseye-slim AS builder WORKDIR /workspace # Install build dependencies required by Electron apps RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ curl \ python3 \ git \ build-essential \ pkg-config \ libx11-xcb1 \ libnss3 \ libxss1 \ libasound2 \ libatk-bridge2.0-0 \ libgtk-3-0 \ libsecret-1-0 \ libgbm1 \ libxkbcommon0 \ libxcb-dri3-0 \ libx11-6 \ --no-install-recommends && rm -rf /var/lib/apt/lists/* # Install pnpm for workspace management RUN npm i -g pnpm # Copy repository into the image COPY . . # Install dependencies for the workspace RUN pnpm i # Build the desktop app from source WORKDIR /workspace/apps/desktop RUN pnpm update:main-hash RUN pnpm build:electron-vite RUN pnpm build:electron-forge FROM debian:bookworm-slim AS runtime # Minimal runtime dependencies for AppImage or Electron-based artifacts RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ libnss3 \ libasound2 \ libx11-xcb1 \ libxcb-dri3-0 \ libxss1 \ libatk-bridge2.0-0 \ libgtk-3-0 \ libsecret-1-0 \ --no-install-recommends && rm -rf /var/lib/apt/lists/* # Copy built artifacts from the builder stage COPY --from=builder /workspace/apps/desktop/out /workspace/apps/desktop/out # Create a small launcher script that will try to run the AppImage if present, # otherwise drop into a shell for debugging. RUN mkdir -p /usr/local/bin RUN bash -lc 'cat > /usr/local/bin/run-app.sh <<"SH" #!/bin/sh set -e APP_IMAGE=$(find /workspace/apps/desktop/out/make -name "*.AppImage" 2>/dev/null | head -n1) if [ -x "$APP_IMAGE" ]; then exec "$APP_IMAGE" "$@" fi # If no AppImage, fall back to an interactive shell so you can inspect the build exec /bin/bash SH ' RUN chmod +x /usr/local/bin/run-app.sh WORKDIR /workspace CMD ["/usr/local/bin/run-app.sh"]
node_modules/ dist/ .gradle/ .build/ .vscode/ .git/ .env .normalized/ *.log *.tmp *.tmp
# Multi-stage Dockerfile to build Folo desktop from source and provide a runnable AppImage (if produced) or a shell fallback. FROM node:20-bullseye-slim AS builder WORKDIR /workspace # Install build dependencies required by Electron apps RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ curl \ python3 \ git \ build-essential \ pkg-config \ libx11-xcb1 \ libnss3 \ libxss1 \ libasound2 \ libatk-bridge2.0-0 \ libgtk-3-0 \ libsecret-1-0 \ libgbm1 \ libxkbcommon0 \ libxcb-dri3-0 \ libx11-6 \ --no-install-recommends && rm -rf /var/lib/apt/lists/* # Install pnpm for workspace management RUN npm i -g pnpm # Copy repository into the image COPY . . # Install dependencies for the workspace RUN pnpm i # Build the desktop app from source WORKDIR /workspace/apps/desktop RUN pnpm update:main-hash RUN pnpm build:electron-vite RUN pnpm build:electron-forge FROM debian:bookworm-slim AS runtime # Minimal runtime dependencies for AppImage or Electron-based artifacts RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ libnss3 \ libasound2 \ libx11-xcb1 \ libxcb-dri3-0 \ libxss1 \ libatk-bridge2.0-0 \ libgtk-3-0 \ libsecret-1-0 \ --no-install-recommends && rm -rf /var/lib/apt/lists/* # Copy built artifacts from the builder stage COPY --from=builder /workspace/apps/desktop/out /workspace/apps/desktop/out # Create a small launcher script that will try to run the AppImage if present, # otherwise drop into a shell for debugging. RUN mkdir -p /usr/local/bin RUN bash -lc 'cat > /usr/local/bin/run-app.sh <<"SH" #!/bin/sh set -e APP_IMAGE=$(find /workspace/apps/desktop/out/make -name "*.AppImage" 2>/dev/null | head -n1) if [ -x "$APP_IMAGE" ]; then exec "$APP_IMAGE" "$@" fi # If no AppImage, fall back to an interactive shell so you can inspect the build exec /bin/bash SH ' RUN chmod +x /usr/local/bin/run-app.sh WORKDIR /workspace CMD ["/usr/local/bin/run-app.sh"]
#0 building with "default" instance using docker driver #1 [internal] load build definition from Dockerfile #1 transferring dockerfile: 2.05kB done #1 DONE 0.1s Dockerfile:67 -------------------- 65 | RUN bash -lc 'cat > /usr/local/bin/run-app.sh <<"SH" 66 | #!/bin/sh 67 | >>> set -e 68 | 69 | APP_IMAGE=$(find /workspace/apps/desktop/out/make -name "*.AppImage" 2>/dev/null | head -n1) -------------------- ERROR: failed to build: failed to solve: dockerfile parse error on line 67: unknown instruction: set (did you mean user?)
FROM node:20-bullseye-slim AS builder WORKDIR /workspace # Install build dependencies required by Electron apps RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ curl \ python3 \ git \ build-essential \ pkg-config \ libx11-xcb1 \ libnss3 \ libxss1 \ libasound2 \ libatk-bridge2.0-0 \ libgtk-3-0 \ libsecret-1-0 \ libgbm1 \ libxkbcommon0 \ libxcb-dri3-0 \ libx11-6 \ --no-install-recommends && rm -rf /var/lib/apt/lists/* # Install pnpm for workspace management RUN npm i -g pnpm # Copy repository into the image COPY . . # Install dependencies for the workspace RUN pnpm i # Build the desktop app from source WORKDIR /workspace/apps/desktop RUN pnpm update:main-hash RUN pnpm build:electron-vite RUN pnpm build:electron-forge FROM debian:bookworm-slim AS runtime # Minimal runtime dependencies for AppImage or Electron-based artifacts RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ libnss3 \ libasound2 \ libx11-xcb1 \ libxcb-dri3-0 \ libxss1 \ libatk-bridge2.0-0 \ libgtk-3-0 \ libsecret-1-0 \ --no-install-recommends && rm -rf /var/lib/apt/lists/* # Copy built artifacts from the builder stage COPY --from=builder /workspace/apps/desktop/out /workspace/apps/desktop/out WORKDIR /workspace CMD ["/bin/bash"]
Concerns: Runtime image may be missing libgbm1, which Electron apps commonly require at runtime, Final CMD is /bin/bash, which means the container won't auto-launch the app; consider providing an entrypoint to start the app or document how to run it, COPY . . in the builder stage copies the entire repo; could be optimized with a more selective copy (e.g., package manifests first) to leverage Docker cache Smoke [PASS]: test -d /workspace/apps/desktop/out Smoke [PASS]: set -e; [ -n "$(ls -A /workspace/apps/desktop/out 2>/dev/null)" ] Smoke [PASS]: set -e; first=$(ls -A /workspace/apps/desktop/out 2>/dev/null | head -n1); [ -n "$first" ]