Files
project-claude/Dockerfile
T
ogrechko 8d76c4d797 Add Docker Compose deployment
Full node_modules image (not output: standalone — its file-tracing drops
argon2's JS loader and segfaults in prod). drizzle.config.ts now honors
DATA_DIR like the sibling projects, so db:migrate targets the mounted
volume instead of an image-local path.
2026-08-27 11:03:56 +00:00

32 lines
1.1 KiB
Docker

FROM node:20-bookworm-slim
# python3/make/g++ let npm fall back to compiling better-sqlite3/argon2 from
# source if no prebuilt binary matches this platform.
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 make g++ ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm install
COPY . .
# next.config.ts: not using output: "standalone" — its file-tracing only
# copies argon2's native .node binaries, not its JS loader, which segfaults
# in production. Deploying against the full node_modules via `next start`
# (this whole image, no standalone pruning) avoids that.
#
# `next build`'s page-data collection spins up parallel workers that each
# import the db client at module-eval time. If data/db.sqlite doesn't exist
# yet, every worker races to create it from scratch, which can throw
# SQLITE_BUSY. Migrating first, as its own isolated step, avoids the race.
RUN mkdir -p data && npm run db:migrate
RUN npm run build
ENV NODE_ENV=production
EXPOSE 8180
CMD ["sh", "-c", "npm run db:migrate && npm start"]