-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (28 loc) · 835 Bytes
/
Dockerfile
File metadata and controls
43 lines (28 loc) · 835 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
38
39
40
41
# Stage 1: Build Stage
FROM node:22 AS build
# Set working directory
WORKDIR /app
# Copy package.json and package-lock.json
COPY package*.json ./
# Install all dependencies (including devDependencies)
RUN npm install --ignore-scripts
# Copy the rest of the application code
COPY . .
# Build the TypeScript application
RUN npm run build
# Remove development dependencies
RUN npm prune --production
# Stage 2: Production Stage
FROM node:22
# Set working directory
WORKDIR /app
# Copy package.json to the container
COPY package*.json ./
# Copy the production node_modules from the build stage
COPY --from=build /app/node_modules ./node_modules
# Copy the built application from the build stage
COPY --from=build /app/dist ./dist
#Expose the aplication port
EXPOSE 4120
# Start the application
CMD ["node", "dist/index.js"]