Prior pin pnpm@11.1.3 was insufficient — pnpm 11.x itself imports `node:sqlite` and requires Node 22.13+, not just 11.4 as the previous blocker entry assumed. Local builds passed only because no `pnpm install` ran on Node 20 (lockfile already resolved). VPS cold build still crashes `ERR_UNKNOWN_BUILTIN_MODULE: node:sqlite`. Switch to pnpm 10.13.1 — already cached on the dev host via corepack, last major before the node:sqlite cache backend, reads lockfile v9.0 unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
35 lines
893 B
Docker
35 lines
893 B
Docker
# ---- stage 1: builder -----------------------------------------------
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install pnpm via corepack
|
|
RUN corepack enable && corepack prepare pnpm@10.13.1 --activate
|
|
|
|
# Copy manifests first for layer caching
|
|
COPY package.json pnpm-lock.yaml* ./
|
|
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
# Copy source and build
|
|
COPY . .
|
|
RUN pnpm build
|
|
|
|
# ---- stage 2: runner ------------------------------------------------
|
|
FROM nginx:alpine AS runner
|
|
|
|
# Copy built static assets
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
# Copy custom nginx config and entrypoint
|
|
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
|
|
COPY docker/entrypoint.sh /entrypoint.sh
|
|
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
# Drop root: nginx master runs as root for port binding, workers as nginx
|
|
# The entrypoint writes env.js before exec-ing nginx
|
|
EXPOSE 8080
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|