chore: v0.2.6 — Docker build on bun, prod-only runtime image
This commit is contained in:
+18
-5
@@ -1,7 +1,17 @@
|
||||
FROM node:22-alpine AS deps
|
||||
# Multi-stage build: bun for installs (fast), node for build + runtime.
|
||||
# No BuildKit type=cache mounts: they don't persist across builds on this daemon
|
||||
# (Docker 29 + containerd image store), and bun install is fast enough (~3s cold)
|
||||
# that cross-build tarball caching isn't worth the complexity.
|
||||
FROM oven/bun:1.4.2-alpine AS deps
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
COPY package.json bun.lock ./
|
||||
RUN bun install --frozen-lockfile
|
||||
|
||||
# Production dependencies only — devDeps (typescript, vitest, @types) are build-time only.
|
||||
FROM oven/bun:1.4.2-alpine AS prod-deps
|
||||
WORKDIR /app
|
||||
COPY package.json bun.lock ./
|
||||
RUN bun install --production --frozen-lockfile
|
||||
|
||||
FROM node:22-alpine AS build
|
||||
WORKDIR /app
|
||||
@@ -10,12 +20,15 @@ COPY . .
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
RUN npm run build
|
||||
|
||||
# No `output: 'standalone'`: the runtime stage keeps the full node_modules because
|
||||
# No `output: 'standalone'`: the runtime stage keeps node_modules because
|
||||
# /api/mlworker/[file] reads maplibre-gl dist files from disk at runtime, and
|
||||
# /api/airports reads data/*.csv — both resolved relative to process.cwd().
|
||||
FROM node:22-alpine AS runtime
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production NEXT_TELEMETRY_DISABLED=1
|
||||
COPY --from=build /app ./
|
||||
COPY --from=prod-deps /app/node_modules ./node_modules
|
||||
COPY --from=build /app/.next ./.next
|
||||
COPY --from=build /app/package.json ./package.json
|
||||
COPY --from=build /app/data ./data
|
||||
EXPOSE 3000
|
||||
CMD ["npm", "run", "start"]
|
||||
|
||||
Reference in New Issue
Block a user