forked from bcgov/bcbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
51 lines (38 loc) · 1.11 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
# FROM docker.io/node:16.15.0-alpine # Last known working alpine image
# RedHat Image Catalog references
# https://catalog.redhat.com/software/containers/ubi9/nodejs-18/62e8e7ed22d1d3c2dfe2ca01
# https://catalog.redhat.com/software/containers/ubi9/nodejs-18-minimal/62e8e919d4f57d92a9dee838
#
# Build the application
#
FROM registry.access.redhat.com/ubi9/nodejs-18:1-48 as application
ENV NO_UPDATE_NOTIFIER=true
USER 0
COPY app /tmp/src/app
WORKDIR /tmp/src/app
RUN chown -R 1001:0 /tmp/src/app
USER 1001
RUN npm ci --omit=dev
#
# Build the frontend
#
FROM registry.access.redhat.com/ubi9/nodejs-18:1-48 as frontend
ENV NO_UPDATE_NOTIFIER=true
USER 0
COPY frontend /tmp/src/frontend
WORKDIR /tmp/src/frontend
RUN chown -R 1001:0 /tmp/src/frontend
USER 1001
RUN npm ci && npm run build
#
# Create the final container image
#
FROM registry.access.redhat.com/ubi9/nodejs-18-minimal:1-51
ENV APP_PORT=8080 \
NO_UPDATE_NOTIFIER=true
COPY --from=application /tmp/src/app ${HOME}
COPY --from=frontend /tmp/src/frontend/dist ${HOME}/dist
COPY .git ${HOME}/.git
WORKDIR ${HOME}
EXPOSE ${APP_PORT}
CMD ["npm", "run", "start"]