forked from linode/apl-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (35 loc) · 1.09 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
FROM otomi/tools:v1.6.0 as ci
ENV APP_HOME=/home/app/stack
RUN mkdir -p $APP_HOME
WORKDIR $APP_HOME
ARG SKIP_TESTS='false'
ENV NODE_ENV='test'
ENV CI=true
ENV ENV_DIR=$APP_HOME/env
ENV IN_DOCKER='1'
ENV VERBOSITY='2'
ENV DISABLE_SYNC='1'
ENV NODE_PATH='dist'
COPY --chown=app . .
RUN npm config set update-notifier false
RUN npm ci --ignore-scripts && npm run compile
RUN if [ "$SKIP_TESTS" = 'false' ]; then ln -s $APP_HOME/tests/fixtures env && npm test && rm env; fi
# --------------- Cleanup
FROM ci as clean
# below command removes the packages specified in devDependencies and set NODE_ENV to production
RUN npm prune --production
#-----------------------------
FROM otomi/tools:v1.6.0 as prod
ENV APP_HOME=/home/app/stack
ENV ENV_DIR=/home/app/stack/env
ENV IN_DOCKER='1'
ENV VERBOSITY='0'
ENV NODE_NO_WARNINGS='1'
ENV NODE_PATH='dist'
RUN npm config set update-notifier false
RUN mkdir -p $APP_HOME
WORKDIR $APP_HOME
COPY --from=ci /home/app/stack/dist /home/app/stack/dist
COPY --from=clean /home/app/stack/node_modules /home/app/stack/node_modules
COPY --chown=app . .
CMD ["dist/src/otomi.js"]