-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (22 loc) · 817 Bytes
/
Copy pathDockerfile
File metadata and controls
33 lines (22 loc) · 817 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
33
FROM node:20-alpine AS builder
WORKDIR /app
# Dependencies are copied separately from source code to leverage Docker layer caching
COPY package*.json ./
# All deps (including devDependencies) are needed here for tsc and ts-node
RUN npm ci
COPY tsconfig.json jest.config.ts ./
COPY src ./src
RUN npm run build
# swagger-output.json is generated by npm run build (via npm run swagger)
# and referenced at runtime from the project root
FROM node:20-alpine AS production
WORKDIR /app
# Only production deps — typescript/ts-node are no longer needed since code is already compiled
COPY package*.json ./
RUN npm ci --omit=dev
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/swagger-output.json ./swagger-output.json
ENV NODE_ENV=production
ENV PORT=3000
EXPOSE 3000
CMD ["node", "dist/index.js"]