forked from biosimulations/biosimulations
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
55 lines (44 loc) · 1.16 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
49
50
51
52
53
54
55
#############
### base ###
#############
FROM node:14-alpine as base
#The name of the app to build
ARG app
ENV APP=$app
RUN echo building ${APP}
# Copy over dependency list
COPY biosimulations/tsconfig.base.json /app/tsconfig.base.json
COPY biosimulations/package.json /app/package.json
COPY biosimulations/package-lock.json /app/package-lock.json
#############
### build ###
#############
from base as build
# set working directory
WORKDIR /app
# add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH
# install nrwl cli
RUN npm install -g @nrwl/cli
# copy source
Copy biosimulations/nx.json /app/nx.json
Copy biosimulations/angular.json /app/angular.json
Copy biosimulations/libs /app/libs
Copy biosimulations/apps /app/apps
# install the app, including the dev dependencies
RUN npm ci
# generate build
RUN nx build ${APP} --prod
############
### prod ###
############
# base image
FROM base as prod
WORKDIR /app
# install the app and include only dependencies needed to run
RUN npm ci --only=production
# copy artifact build from the 'build environment'
RUN echo app is ${APP}
COPY --from=build /app/dist/apps/${APP}/ .
EXPOSE 3333
CMD node main.js