# Build the static bundle and serve it with nginx — the whole app is `dist/`, # so nothing runs server-side once the image is up. # # The VITE_* values the build bakes in come from a committed env file — # .env.production by default, .env.dev when BUILD_MODE=dev (the dev.chalky.town # Coolify app sets that build arg). They're public by design (see # src/lib/config.ts), so `docker build .` produces the real production image # anywhere with no args, and the dev image with exactly one. FROM node:22-alpine AS build WORKDIR /app # Pinned rather than left to corepack's default: pnpm 10 reads # patchedDependencies out of pnpm-workspace.yaml (pnpm 9 expects it in # package.json), and svelte-dnd-action is patched there. RUN npm install --global pnpm@10.18.3 # Manifests and the patch first, so the install layer survives source edits. COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ COPY patches ./patches RUN pnpm install --frozen-lockfile COPY . . # Type-check here rather than in the pipeline, so it gates the thing it should # gate: a failed build means Coolify never swaps the container and the running # site is left alone. `vite build` alone wouldn't catch this — svelte-check and # tsc are what read the types. RUN pnpm check ARG BUILD_MODE=production RUN pnpm build --mode $BUILD_MODE FROM nginx:1.27-alpine COPY nginx.conf /etc/nginx/conf.d/default.conf COPY --from=build /app/dist /usr/share/nginx/html