|
1 | | -# meshhook on dev2: a plain image because nixpacks' pinned nixpkgs ships Node 22.11 |
2 | | -# while pnpm 11.18 needs >= 22.13 and has no nodejs_24. Same commands railway.toml ran. |
3 | | -FROM node:24-bookworm-slim |
| 1 | +# syntax=docker/dockerfile:1 |
| 2 | +# |
| 3 | +# meshhook.com on dev2, run on Bun. dev2's compose stack builds this file |
| 4 | +# (/home/anthony/www/meshhook.com/docker-compose.app.yml, `dockerfile: Dockerfile`). |
| 5 | +# |
| 6 | +# One container, the same two processes as before: server.mjs supervises the |
| 7 | +# SvelteKit web app (adapter-node build) and the queue orchestrator. It spawns |
| 8 | +# both with process.execPath, so under Bun they run on Bun too. |
| 9 | +# |
| 10 | +# Contract with dev2, unchanged from the Node image: listens on 3000 (compose maps |
| 11 | +# 127.0.0.1:APP_PORT), answers / for the deploy health check, reads DATABASE_URL, |
| 12 | +# ORIGIN and the rest from app.env at run time. |
| 13 | +FROM oven/bun:1.4.0-slim |
4 | 14 | WORKDIR /app |
5 | | -RUN corepack enable && corepack prepare pnpm@11.18.0 --activate |
6 | | -COPY . . |
7 | | -RUN pnpm install --frozen-lockfile && pnpm --filter @meshhook/web run build |
| 15 | +RUN chown bun:bun /app |
| 16 | +USER bun |
| 17 | +# The workspace manifests first, so a source-only change keeps the install layer. |
| 18 | +COPY --chown=bun:bun package.json bun.lock ./ |
| 19 | +COPY --chown=bun:bun apps/web/package.json apps/web/ |
| 20 | +COPY --chown=bun:bun workers/package.json workers/ |
| 21 | +COPY --chown=bun:bun packages/shared/package.json packages/shared/ |
| 22 | +COPY --chown=bun:bun packages/cli/package.json packages/cli/ |
| 23 | +COPY --chown=bun:bun scripts/socket-patch.mjs scripts/ |
| 24 | +RUN bun install --frozen-lockfile |
| 25 | +COPY --chown=bun:bun . . |
| 26 | +# `bun --bun vite build`: the SvelteKit build runs on Bun, not Node. |
| 27 | +RUN bun run build |
8 | 28 | ENV NODE_ENV=production |
9 | 29 | EXPOSE 3000 |
10 | | -CMD ["node", "server.mjs"] |
| 30 | +# 127.0.0.1, not localhost: localhost can resolve ::1 first. |
| 31 | +HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \ |
| 32 | + CMD bun -e "fetch('http://127.0.0.1:'+(process.env.PORT||3000)+'/').then(r=>process.exit(r.status<500?0:1)).catch(()=>process.exit(1))" |
| 33 | +CMD ["bun", "server.mjs"] |
0 commit comments