forked from OWASP/threat-dragon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
46 lines (40 loc) · 1.27 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
# Builds td.server. This step requires dev dependencies
# that do not need to be included in the final image
FROM node:14 as build-backend
WORKDIR /app
COPY ./td.server/package* ./
RUN npm ci
COPY ./td.server/.babelrc ./
COPY ./td.server/src ./src
RUN npm run build
# Builds td.site. This step requires dev dependencies
# that do not need to be included in the final image
FROM node:14 as build-frontend
WORKDIR /app/td.site
COPY ./td.site/package* ./
RUN npm ci
COPY ./td.site/src ./src
COPY ./td.site/webpack.config.js ./
RUN npm run build
# Get the runtime dependencies for td.server that we will
# need for the final image
FROM node:14 as deps-backend
WORKDIR /app
COPY ./td.server/package* ./
RUN npm ci --only=production
# Get the runtime dependencies for td.site that we will
# need for the final image
FROM node:14 as deps-frontend
WORKDIR /app
COPY ./td.site/package* ./
RUN npm ci --only=production
# The final image with only the bundled code and
# production dependencies
FROM gcr.io/distroless/nodejs:14
WORKDIR /app
COPY --from=deps-backend /app ./td.server
COPY --from=deps-frontend /app ./td.site
COPY --from=build-backend /app/dist ./td.server/dist
COPY --from=build-frontend /app/dist /app/dist
COPY ./td.server/index.js ./td.server/index.js
CMD ["td.server/index.js"]