Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use nginx stable from dockerhub #4038

Merged
merged 19 commits into from
Oct 22, 2024
25 changes: 17 additions & 8 deletions Dockerfile.web
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
ARG NODE_OPTIONS="--v8-pool-size=4"

# PHASE 1 - build frontend.
FROM node:20-alpine AS static
FROM docker.io/library/node:20-alpine AS static
# Switch to root user for package installs
USER 0
WORKDIR /app
Expand All @@ -21,18 +21,27 @@ RUN corepack enable \
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
FROM docker.io/library/nginx:stable-alpine

# Add application sources
ADD ./openshift/nginx.conf "${NGINX_CONF_PATH}"
# Copy application sources
COPY ./openshift/nginx.conf /etc/nginx/nginx.conf

# Copy the static content:
COPY --from=static /app/build .

RUN mkdir -p /tmp/nginx/client_temp
RUN chmod -R 755 /tmp/nginx

RUN mkdir -p /var/cache/nginx/proxy_temp
RUN mkdir -p /var/cache/nginx/fastcgi_temp
RUN mkdir -p /var/cache/nginx/uwsgi_temp
RUN mkdir -p /var/cache/nginx/scgi_temp
RUN chmod -R 755 /var/cache/nginx/
RUN chmod -R 755 /var/run

# Switch back to default user
USER 1001

EXPOSE 3000
CMD nginx -g "daemon off;"
9 changes: 8 additions & 1 deletion openshift/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# * Official English Documentation: http://nginx.org/en/docs/
error_log /dev/stdout info;

# For openshift permissions
pid /tmp/nginx.pid;

events {
worker_connections 1024;
}
Expand All @@ -11,10 +14,14 @@ http {
default_type application/octet-stream;
access_log /dev/stdout;

# For openshift to have permissions
client_body_temp_path /tmp/nginx/client_temp;

server {
# listen on port 3000
listen 3000;
root /opt/app-root/src;
root /;
index index.html

gzip on;
# By default, NGINX compresses responses only with MIME type text/html.
Expand Down
2 changes: 1 addition & 1 deletion openshift/templates/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ objects:
timeoutSeconds: 1
volumeMounts:
- name: config-env
mountPath: "/opt/app-root/src/config.js"
mountPath: "/config.js"
subPath: gold.config.js
#############################################################################
# API container
Expand Down
Loading