forked from bcgov/wps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.web
38 lines (31 loc) · 1.16 KB
/
Dockerfile.web
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
# SUPER IMPORTANT: NODE_OPTIONS="--v8-pool-size=1"
# A pod running in our openshift cluster, will report a ridiculous amount of cpu's available, as
# it's reporting on the underlying hardware. Node, in it's wisdom, will try to scale to using a
# huge amount of cpu's, which in turn results in massive memory usage. It's very important to limit
# the cpu pool size to something realistic.
ARG NODE_OPTIONS="--v8-pool-size=4"
# PHASE 1 - build frontend.
FROM node:20-alpine AS static
# Switch to root user for package installs
USER 0
WORKDIR /app
COPY web/package.json .
COPY web/yarn.lock .
COPY web/.yarnrc.yml .
# do install first so it will be cached
RUN corepack enable \
&& yarn set version berry \
&& CYPRESS_INSTALL_BINARY=0 yarn install --immutable
COPY web .
RUN yarn run build:prod
# Switch back to default user
USER 1001
# PHASE 2 - prepare hosting.
# https://catalog.redhat.com/software/containers/ubi8/nginx-120/6156abfac739c0a4123a86fd
FROM registry.access.redhat.com/ubi8/nginx-120
# Add application sources
ADD ./openshift/nginx.conf "${NGINX_CONF_PATH}"
# Copy the static content:
COPY --from=static /app/build .
EXPOSE 3000
CMD nginx -g "daemon off;"