-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
38 lines (26 loc) · 872 Bytes
/
Dockerfile
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
# Development Stage
FROM node:22-alpine AS development
# Define working dir in container
WORKDIR /app
# Copy package.json and package-lock.json to container
COPY package*.json ./
# Set registry to npmjs registry and install dependencies
RUN yarn install --frozen-lockfile
# Copy all files to container
COPY . .
# Build the application for production
RUN yarn build
# Start the application in development mode
CMD ["yarn", "dev"]
# Production Stage
FROM node:22-alpine AS production
# Define working dir in container
WORKDIR /app
# Copy package.json and package-lock.json to container
COPY package*.json ./
# Set registry to npmjs registry and install dependencies
RUN yarn install --frozen-lockfile --only=production
# Copy all files to container
COPY --from=development /app/dist ./dist
# Start the application in production mode
CMD ["node", "dist/index.js"]