-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.fullstack
More file actions
55 lines (40 loc) · 1.51 KB
/
Dockerfile.fullstack
File metadata and controls
55 lines (40 loc) · 1.51 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
55
# ============================================
# Protocol Guide - Fullstack Dockerfile
# Builds BOTH server bundle AND Expo web export
# Mirrors Netlify (web) + Railway (API) in a single image
# ============================================
# --- Base: Node 20 + pnpm ---
FROM node:20-alpine AS base
RUN corepack enable && corepack prepare pnpm@9.12.0 --activate
WORKDIR /app
# --- Dependencies: install ALL deps (devDeps needed for Expo/NativeWind) ---
FROM base AS deps
COPY package.json pnpm-lock.yaml .npmrc* ./
RUN pnpm install --frozen-lockfile
# --- Build: server + web ---
FROM deps AS build
COPY . .
# Fix NativeWind cache (required before Expo web build)
RUN node scripts/fix-nativewind-cache.js
# Build server bundle (esbuild)
RUN pnpm build
# Build Expo web export + PWA meta injection
RUN pnpm build:web
# --- Production: server serves both API and static web files ---
FROM base AS production
ENV NODE_ENV=production
# Install production dependencies only
COPY package.json pnpm-lock.yaml .npmrc* ./
RUN pnpm install --frozen-lockfile --prod
# Copy server bundle + web export (both land in dist/)
COPY --from=build /app/dist ./dist
# Copy drizzle migrations
COPY drizzle ./drizzle
# Copy shared constants/types
COPY shared ./shared
# Copy public assets (PWA manifest, icons, etc.)
COPY --from=build /app/public ./public
EXPOSE 3001
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3001/api/live || exit 1
CMD ["node", "dist/index.js"]