-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile.web
42 lines (33 loc) · 1.62 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
39
40
41
42
# 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/ubi9/nodejs-20 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 [email protected]
RUN npm config set @psu:registry https://artifacts.developer.gov.bc.ca/artifactory/api/npm/pe1e-psu-npm-local/
RUN npm config set //artifacts.developer.gov.bc.ca/artifactory/api/npm/pe1e-psu-npm-local/:_authToken ${ARTIFACTORY_SVCACCT_TOKEN}
RUN npm install -g yarn@latest && yarn install --frozen-lockfile
RUN yarn run build:prod
# Remove sourcemaps after they've been uploaded to sentry
RUN rm build/static/js/**.map
# 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;"