-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (25 loc) · 939 Bytes
/
Dockerfile
File metadata and controls
37 lines (25 loc) · 939 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
34
35
36
37
# ------------ STAGE 1: Build Stage ------------
FROM node:22.14.0-slim AS builder
WORKDIR /usr/src/app
# Install deps for build
COPY package*.json ./
RUN npm install
# Copy full source code and build it
COPY . .
RUN npm run build
# ------------ STAGE 2: Production Stage ------------
FROM node:22.14.0-slim
WORKDIR /usr/src/app
# Copy only production dependencies
COPY package*.json ./
RUN npm install --omit=dev
# Copy built code from builder
COPY --from=builder /usr/src/app/dist ./dist
COPY --from=builder /usr/src/app/swagger.yaml ./swagger.yaml
COPY --from=builder /usr/src/app/public ./public
# Copy any necessary runtime assets (optional)
# COPY --from=builder /usr/src/app/public ./public
# Expose the app port
EXPOSE 8080
# Define the startup command
CMD ["node", "dist/server.js"]