-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathDockerfile
38 lines (28 loc) · 887 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
# --- Base Node ---
FROM node:boron AS base
RUN mkdir -p /var/www
RUN mkdir -p /var/log/portal-service
ADD package.json /var/www
# use changes to package.json to force Docker not to use the cache
# when we change our application's nodejs dependencies:
# --- Dependencies ---
FROM base AS dependencies
COPY . /tmp/
RUN cd /tmp && npm install --only=production
RUN cp -R /tmp/node_modules /tmp/prod_node_modules
RUN cd /tmp && npm install
# --- Build ---
FROM dependencies AS build
COPY ./src /tmp/src
RUN cd /tmp && npm run build
COPY ./src/common/config/creds /tmp/dist/common/config/creds
# --- Release ---
FROM base AS release
WORKDIR /var/www
# create empty .env file for dotenv lib
RUN touch .env
COPY --from=dependencies /tmp/prod_node_modules ./node_modules
COPY --from=build /tmp/dist ./dist
VOLUME /var/log/portal-service
EXPOSE 3000
CMD [ "npm", "run", "start:prod" ]