-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
46 lines (31 loc) · 884 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
46
FROM node:14.15.1 as builder
ARG NODE_ENV=production
ENV NODE_ENV $NODE_ENV
# copy project source code
COPY --chown=node:node . /opt/app
USER node
WORKDIR /opt/app
ENV PATH /opt/app/node_modules/.bin:$PATH
RUN NODE_ENV=development npm install && npm cache clean --force
RUN npm run build
FROM node:14.15.1-alpine
ENV DOCKER 1
ARG PORT=3000
ENV PORT $PORT
EXPOSE $PORT
ARG NODE_ENV=production
ENV NODE_ENV $NODE_ENV
ARG DB_HOST
ENV DB_HOST $DB_HOST
ARG DB_PORT
ENV DB_PORT $DB_PORT
ARG REDIS_HOST
ENV REDIS_HOST $REDIS_HOST
ARG REDIS_PORT
ENV REDIS_PORT $REDIS_PORT
ENV PATH /opt/app/node_modules/.bin:$PATH
WORKDIR /opt/app
# start the node application
CMD [ "sh", "start.sh" ]
COPY --from=builder /opt/app/dist/src /opt/app/dist/ormconfig.js /opt/app/package.json /opt/app/package-lock.json /opt/app/wait-for-it.sh /opt/app/
RUN npm install && npm cache clean --force