From 399cd092058fd4c19825e2c4318b57df1894ad14 Mon Sep 17 00:00:00 2001 From: EvgeniGenchev Date: Tue, 21 Apr 2026 12:38:15 +0200 Subject: [PATCH 1/2] feat: add docker support --- .dockerignore | 10 ++++++++++ Dockerfile | 11 +++++++++++ docker-compose.yml | 8 ++++++++ 3 files changed, 29 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..06b6abd8d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +.git +node_modules +**/node_modules +**/.next +**/.turbo +**/dist +.env +.env.local +.env*.local +*.log diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..605e3a934 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM oven/bun:1.3.0-alpine +WORKDIR /app + +COPY . . +RUN bun install --frozen-lockfile +RUN touch apps/editor/.env.local +RUN ./node_modules/.bin/turbo run build --filter=editor + +EXPOSE 3000 +WORKDIR /app/apps/editor +CMD ["bun", "run", "start"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..c5b5caf88 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +services: + editor: + build: . + ports: + - "3000:3000" + environment: + NODE_ENV: production + restart: unless-stopped From b9d7266b38d6d12dfb88a9556b7509efd2aac24a Mon Sep 17 00:00:00 2001 From: Aymeric Rabot Date: Tue, 4 Aug 2026 18:27:57 -0400 Subject: [PATCH 2/2] fix(docker): persist scenes, drop root, and build with a real node MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three problems kept the image from being usable: - Saved scenes went to $HOME/.pascal/data inside the container layer, so `docker compose down` silently discarded every project. Set PASCAL_DATA_DIR and back it with a named volume. - The container ran as root. The base image already ships a `bun` user. - `next build` runs under `node`, and oven/bun's `node` is a shim that re-execs bun. Next 16's build crashes it on both arm64 and amd64 — segfault on bun 1.3.14, a turbopack CommonJS error on 1.3.0. Install real nodejs. CI never hit this because runners have their own node. Also pins the base image to the bun version in `packageManager` and drops the `touch apps/editor/.env.local` workaround, which no longer matches the path the build script reads. Co-Authored-By: Claude Opus 5 --- Dockerfile | 18 ++++++++++++++++-- docker-compose.yml | 11 +++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 605e3a934..11741c831 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,25 @@ -FROM oven/bun:1.3.0-alpine +# Matches `packageManager` in package.json and the version CI installs — a skew +# here is what makes `--frozen-lockfile` fail inside the image but not locally. +FROM oven/bun:1.3.14-alpine WORKDIR /app +# `next build` runs under `node`, and this image's `node` is a shim that re-execs +# bun (/usr/local/bun-node-fallback-bin/node). Next 16's build crashes it — a +# segfault on 1.3.14, a turbopack CommonJS wrapper error on 1.3.0 — on both arm64 +# and amd64. CI does not hit this because GitHub runners have a real node. +RUN apk add --no-cache nodejs + COPY . . RUN bun install --frozen-lockfile -RUN touch apps/editor/.env.local RUN ./node_modules/.bin/turbo run build --filter=editor +# Saved scenes live in SQLite under PASCAL_DATA_DIR; owned by the runtime user so +# the store can create the database on first write. +RUN mkdir -p /data && chown -R bun:bun /data /app +ENV PASCAL_DATA_DIR=/data +VOLUME /data + +USER bun EXPOSE 3000 WORKDIR /app/apps/editor CMD ["bun", "run", "start"] diff --git a/docker-compose.yml b/docker-compose.yml index c5b5caf88..862452a9f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,18 @@ services: editor: build: . ports: + # Keep the container port at 3000. `/scenes` fetches its own API through a + # base URL that only `NEXT_PUBLIC_APP_URL` can override, and Next inlines + # that at build time — so a remapped host port 500s the page. - "3000:3000" environment: NODE_ENV: production + # Scene database location. Without the volume below, every saved project is + # discarded when the container is recreated. + PASCAL_DATA_DIR: /data + volumes: + - pascal-data:/data restart: unless-stopped + +volumes: + pascal-data: