-
Notifications
You must be signed in to change notification settings - Fork 182
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (45 loc) · 1.38 KB
/
Dockerfile
File metadata and controls
58 lines (45 loc) · 1.38 KB
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
56
57
58
FROM linode/apl-tools:v2.11.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 DIR=$APP_HOME/tests/fixtures
ENV VERBOSITY='2'
ENV DISABLE_SYNC='1'
ENV NODE_PATH='dist'
COPY --chown=app . .
RUN set -e && \
npm config set update-notifier false && \
npm ci --ignore-scripts && \
npm run compile
# Run tests with the CI-specific script that has proper Jest flags
RUN set -e && \
if [ "$SKIP_TESTS" = 'false' ]; then \
echo "Running CI tests..." && \
npm run test:ci && \
echo "Tests completed successfully"; \
else \
echo "Skipping tests (SKIP_TESTS=true)"; \
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 linode/apl-tools:v2.11.0 AS prod
ARG APPS_REVISION=''
ENV APP_HOME=/home/app/stack
ENV ENV_DIR=/home/app/stack/env
ENV VERBOSITY='0'
ENV NODE_NO_WARNINGS='1'
ENV NODE_PATH='dist'
ENV APPS_REVISION=$APPS_REVISION
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 . .
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["node", "dist/src/operator/main.js"]