-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
68 lines (44 loc) · 1.65 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
56
57
58
59
60
61
62
63
64
65
66
67
68
ARG PARENT_VERSION=2.2.2-node20.11.1
ARG PORT=3000
ARG PORT_DEBUG=9229
FROM defradigital/node-development:${PARENT_VERSION} AS development
ENV TZ="Europe/London"
ARG PARENT_VERSION
LABEL uk.gov.defra.ffc.parent-image=defradigital/node-development:${PARENT_VERSION}
ARG PORT
ARG PORT_DEBUG
ENV PORT ${PORT}
EXPOSE ${PORT} ${PORT_DEBUG}
WORKDIR /home/node/app
COPY --chown=node:node ./packag*.json ./
COPY --chown=node:node ./designer/package.json ./designer/
COPY --chown=node:node ./model/package.json ./model/
RUN npm ci
COPY --chown=node:node ./ ./
CMD [ "npm", "run", "dev" ]
FROM development as productionBuild
WORKDIR /home/node/app
ENV NODE_ENV production
RUN npm run build
FROM defradigital/node:${PARENT_VERSION} AS production
ENV TZ="Europe/London"
# Add curl to template.
# CDP PLATFORM HEALTHCHECK REQUIREMENT
USER root
RUN apk update && \
apk add curl
USER node
ARG PARENT_VERSION
LABEL uk.gov.defra.ffc.parent-image=defradigital/node:${PARENT_VERSION}
WORKDIR /home/node/app
COPY --from=productionBuild --chown=node:node /home/node/app/packag*.json ./
COPY --from=productionBuild --chown=node:node /home/node/app/model/package.json ./model/
COPY --from=productionBuild --chown=node:node /home/node/app/model/dist ./model/dist
COPY --from=productionBuild --chown=node:node /home/node/app/designer/package.json ./designer/package.json
COPY --from=productionBuild --chown=node:node /home/node/app/designer/client/dist ./designer/client/dist
COPY --from=productionBuild --chown=node:node /home/node/app/designer/server/dist ./designer/server/dist
RUN npm ci --omit=dev
ARG PORT
ENV PORT ${PORT}
EXPOSE ${PORT}
CMD [ "npm", "start", "--ignore-scripts" ]