-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
45 lines (29 loc) · 972 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
39
40
41
42
43
44
45
ARG NODE_VERSION=20.12.2
################################################################################
# Use node image for base image for all stages.
FROM node:${NODE_VERSION}-alpine as base
# Set working directory for all build stages.
WORKDIR /app
################################################################################
# Create a stage for installing production dependecies.
FROM base as dev
COPY ./package.json ./
RUN npm install
COPY . .
# Expose the port that the application listens on.
EXPOSE 3001
# Run the application.
CMD ["npm", "run", "dev2"]
################################################################################
# Create a stage for installing production dependecies.
FROM base as prod
COPY ./package.json ./
RUN npm install
COPY . .
# Run the build script.
RUN npm run build \
&& npm install -g pm2
# Expose the port that the application listens on.
EXPOSE 3002
# Run the application.
CMD ["npm", "run", "start"]