Repository navigation
Expand file tree
/
Copy pathDockerfile.bff
More file actions
54 lines (37 loc) · 1.87 KB
/
Copy pathDockerfile.bff
File metadata and controls
54 lines (37 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# ─── BIS BFF — Production Dockerfile ─────────────────────────────────────────
# Multi-stage build: build React PWA + transpile tRPC server, then run lean.
FROM node:22-alpine AS builder
WORKDIR /app
# Install pnpm
RUN corepack enable && corepack prepare pnpm@10.4.1 --activate
# Copy manifests first for layer caching
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
# Copy source
COPY . .
# Build Vite frontend + esbuild server bundle
RUN pnpm run build
# ─── Canonical migration image ───────────────────────────────────────────────
# This target retains the checked-in migration runner and its pinned tooling. It
# is published separately and run once by the promotion workflow before the BFF
# is rolled forward; the production runtime image stays lean.
FROM builder AS migrations
CMD ["pnpm", "db:migrate"]
# ─── Production image ─────────────────────────────────────────────────────────
FROM node:22-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
# Install pnpm for production deps only
RUN corepack enable && corepack prepare pnpm@10.4.1 --activate
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile --prod
# Copy built artefacts
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/client/dist ./client/dist
# Drizzle migrations
COPY --from=builder /app/drizzle ./drizzle
COPY --from=builder /app/drizzle.config.ts ./drizzle.config.ts
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD wget -qO- http://localhost:3000/api/trpc/auth.me || exit 1
CMD ["node", "dist/index.js"]