-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
42 lines (28 loc) · 897 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
# Stage 1: Set up and build
FROM node:10-buster as dev-build
WORKDIR /src
COPY ./package-lock.json .
COPY ./package.json .
RUN npm ci
COPY . .
ARG env=dev
# Make the below conditional. If PROD then build
RUN chmod +x ./docker.sh && ./docker.sh
# RUN npm run build:client && npm run build:server
# ELSE run unit tests
# RUN npm run build:dev && npm run coverage
# THEN build app for staging
# RUN npm run staging:dev && npm run staging:client
# THEN tell Cypress to run E2E tests when we get there
# RUN cypress
# Stage 2 move build files
FROM node:10-buster-slim as prod-build
WORKDIR /app
COPY --from=dev-build /src/package.json .
RUN npm install --only=prod
COPY --from=dev-build /src/assets assets
COPY --from=dev-build /src/dist/app.bundle.js dist/app.bundle.js
COPY --from=dev-build /src/dist/server.bundle.js dist/server.bundle.js
RUN ls
EXPOSE 5000
CMD ["npm", "run", "start"]