-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
43 lines (30 loc) · 949 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
FROM node:18.16-alpine3.17 as builder
# ------------------------------------------
# change the working directory
# ------------------------------------------
WORKDIR /home/node/app
# ------------------------------------------
# install dependences
# ------------------------------------------
RUN yarn global add @nestjs/[email protected]
COPY package.json yarn.lock ./
RUN yarn install --immutable
# ------------------------------------------
# copy content
# ------------------------------------------
COPY . .
RUN yarn build
# ------------------------------------------
# Optomize image size
# ------------------------------------------
FROM node:18.16-alpine3.17
WORKDIR /home/node/app
COPY --from=builder /home/node/app /home/node/app
# ------------------------------------------
# start server
# ------------------------------------------
USER node
EXPOSE 8000
ENV PORT 8000
ENV HOSTNAME "0.0.0.0"
CMD [ "node", "dist/src/main.js" ]