-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
48 lines (35 loc) · 1.85 KB
/
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
46
47
48
###############################################################################
###############################################################################
## _______ _____ ______ _____ ##
## |__ __/ ____| ____| __ \ ##
## | | | (___ | |__ | | | | ##
## | | \___ \| __| | | | | ##
## | | ____) | |____| |__| | ##
## |_| |_____/|______|_____/ ##
## ##
## description : Dockerfile for TsED Application ##
## author : TsED team ##
## date : 2023-12-11 ##
## version : 3.0 ##
## ##
###############################################################################
###############################################################################
ARG NODE_VERSION=20.11.0
FROM node:${NODE_VERSION}-alpine AS build
WORKDIR /opt
COPY package.json package-lock.json tsconfig.json tsconfig.base.json tsconfig.node.json tsconfig.spec.json .barrels.json .swcrc ./
RUN npm ci
COPY ./src ./src
RUN npm run build
FROM node:${NODE_VERSION}-alpine AS runtime
ENV WORKDIR /opt
WORKDIR $WORKDIR
RUN apk update && apk add build-base git curl
RUN npm install -g pm2
COPY --from=build /opt .
RUN npm ci --omit=dev --ignore-scripts
COPY . .
EXPOSE 8081
ENV PORT 8081
ENV NODE_ENV production
CMD ["pm2-runtime", "start", "processes.config.cjs", "--env", "production"]