-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (22 loc) · 760 Bytes
/
Dockerfile
File metadata and controls
32 lines (22 loc) · 760 Bytes
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
FROM node:20-alpine AS builder
WORKDIR /app
# Copy lockfile and manifest first for better caching
COPY server/package.json server/package-lock.json ./
# Install ALL dependencies (includes devDependencies for TypeScript build)
RUN npm ci
# Copy source and tsconfig, then build
COPY server/tsconfig.json ./tsconfig.json
COPY server/src ./src
RUN npm run build
# --- Runtime image ---
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
# Copy manifests and install only production dependencies
COPY server/package.json server/package-lock.json ./
RUN npm ci --omit=dev
# Copy built application
COPY --from=builder /app/dist ./dist
# The app defaults to 3003 and respects PORT provided by Railway
EXPOSE 3003
CMD ["node", "dist/index.js"]