forked from bcgov/wps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.web
37 lines (29 loc) · 1.38 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
ARG DOCKER_IMAGE=image-registry.openshift-image-registry.svc:5000/e1e498-tools/wps-web-base
# 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 static html.
# Pull from local registry - we can't pull from docker due to limits.
# see https://catalog.redhat.com/software/containers/ubi8/nodejs-14/5ed7887dd70cc50e69c2fabb for
# details
FROM registry.access.redhat.com/ubi8/nodejs-16 as static
# Switch to root user for package installs
USER 0
ADD web .
# NOTE: Can't use "--production=true", build will fail.
RUN npm install -g npm@latest && npm install -g yarn@latest && yarn install --frozen-lockfile
RUN yarn run build
# 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 /opt/app-root/src/build .
EXPOSE 3000
CMD nginx -g "daemon off;"