-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (23 loc) · 830 Bytes
/
Dockerfile
File metadata and controls
32 lines (23 loc) · 830 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
# Stage 1: Builder
FROM node:lts-alpine AS builder
WORKDIR /app
# Copy necessary files for installation and build
COPY package.json package-lock.json ./
COPY tsconfig.json ./
COPY src ./src
# Install all dependencies (including devDependencies needed for build)
RUN npm ci
# Build the project
RUN npm run build
# Stage 2: Release
FROM node:lts-alpine AS release
WORKDIR /app
# Copy only necessary files from the builder stage
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/package-lock.json ./package-lock.json
COPY --from=builder /app/dist ./dist
# Install only production dependencies
RUN npm ci --omit=dev --ignore-scripts
# Set the entrypoint to run the compiled server
# Corrected path based on tsconfig.json ("rootDir": ".", "outDir": "dist")
ENTRYPOINT ["node", "dist/src/index.js"]