-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (33 loc) · 1.82 KB
/
Copy pathDockerfile
File metadata and controls
40 lines (33 loc) · 1.82 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
# ─── Stage 1: Build ──────────────────────────────────────────────────────────
FROM node:22-alpine AS build
WORKDIR /app
# Copy workspace root + per-package manifests for efficient layer caching
COPY package.json package-lock.json ./
COPY packages/shared/package.json ./packages/shared/package.json
COPY packages/server/package.json ./packages/server/package.json
COPY packages/client/package.json ./packages/client/package.json
RUN npm ci
# Copy source and build all workspaces (shared must build before server)
COPY tsconfig.json ./
COPY packages/shared ./packages/shared
COPY packages/server ./packages/server
COPY packages/client ./packages/client
RUN npm run build
# ─── Stage 2: Production runtime ────────────────────────────────────────────
FROM node:22-alpine AS runtime
WORKDIR /app
ENV NODE_ENV=production
# Install production deps only for shared + server (client not needed at runtime)
COPY package.json package-lock.json ./
COPY packages/shared/package.json ./packages/shared/package.json
COPY packages/server/package.json ./packages/server/package.json
RUN npm ci --omit=dev --ignore-scripts --workspace @ellmud/shared --workspace @ellmud/server \
&& npm cache clean --force
# Copy compiled output
COPY --from=build /app/packages/shared/dist ./packages/shared/dist
COPY --from=build /app/packages/server/dist ./packages/server/dist
COPY --from=build /app/packages/client/dist ./packages/client/dist
# Copy SQL migration files (not compiled by TypeScript, so missing from dist/)
COPY packages/server/src/db/migrations/*.sql ./packages/server/dist/db/migrations/
EXPOSE 2567
CMD ["node", "packages/server/dist/index.js"]