From cc92e1d415598919250fb7d9dfca7180c55f7f12 Mon Sep 17 00:00:00 2001 From: Riemer Palstra Date: Mon, 24 Jul 2023 11:06:56 +0200 Subject: [PATCH 1/2] OpenShift related changes for Gemeente Rotterdam. --- helm/templates/deployment.yaml | 2 +- helm/templates/hpa.yaml | 2 +- pwa/Dockerfile.openshift | 31 +++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 pwa/Dockerfile.openshift diff --git a/helm/templates/deployment.yaml b/helm/templates/deployment.yaml index 4122da808..7cecd50e8 100644 --- a/helm/templates/deployment.yaml +++ b/helm/templates/deployment.yaml @@ -51,7 +51,7 @@ spec: - name: env mountPath: "/usr/share/nginx/html/env.js" subPath: "env.js" - - mountPath: /var/cache/nginx/client_temp + - mountPath: /var/cache/nginx name: tmpfs - mountPath: /var/run name: tmpfs2 diff --git a/helm/templates/hpa.yaml b/helm/templates/hpa.yaml index d2b4f7592..a8120171a 100644 --- a/helm/templates/hpa.yaml +++ b/helm/templates/hpa.yaml @@ -1,5 +1,5 @@ {{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 +apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: {{ include "api-platform.fullname" . }} diff --git a/pwa/Dockerfile.openshift b/pwa/Dockerfile.openshift new file mode 100644 index 000000000..4742a7fb9 --- /dev/null +++ b/pwa/Dockerfile.openshift @@ -0,0 +1,31 @@ +FROM node:18 AS builder +# Set working directory +WORKDIR /app + +COPY package.json package-lock.json ./ + +# Copy all files from current directory to working dir in image +# install node modules and build assets +RUN npm install + +COPY . . + +RUN npm run build + +FROM nginx +COPY --from=builder /app/public /usr/share/nginx/html + +RUN chown -R 1001:0 /usr/share/nginx && chmod -R ug+rwX /usr/share/nginx && \ + chown -R 1001:0 /var/cache/nginx && \ + chmod -R ug+rwX /var/cache/nginx && \ + chown -R 1001:0 /var/log/nginx && \ + chmod -R ug+rwX /var/log/nginx && \ + chown -R 1001:0 /etc/nginx/conf.d && \ + chmod -R ug+rwX /etc/nginx/conf.d +RUN touch /var/run/nginx.pid && \ + chown -R 1001:0 /var/run/nginx.pid + +COPY docker/nginx.conf /etc/nginx/nginx.conf +COPY docker/default.conf /etc/nginx/conf.d/default.conf +USER 1001 +EXPOSE 8080 From a6f069eea762ebc65df4394a39183b2f5ebc71e9 Mon Sep 17 00:00:00 2001 From: Riemer Palstra Date: Mon, 24 Jul 2023 12:17:55 +0200 Subject: [PATCH 2/2] Correct permissions. --- pwa/Dockerfile.openshift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pwa/Dockerfile.openshift b/pwa/Dockerfile.openshift index 4742a7fb9..e07a9b92d 100644 --- a/pwa/Dockerfile.openshift +++ b/pwa/Dockerfile.openshift @@ -15,6 +15,9 @@ RUN npm run build FROM nginx COPY --from=builder /app/public /usr/share/nginx/html +COPY docker/nginx.conf /etc/nginx/nginx.conf +COPY docker/default.conf /etc/nginx/conf.d/default.conf + RUN chown -R 1001:0 /usr/share/nginx && chmod -R ug+rwX /usr/share/nginx && \ chown -R 1001:0 /var/cache/nginx && \ chmod -R ug+rwX /var/cache/nginx && \ @@ -23,9 +26,7 @@ RUN chown -R 1001:0 /usr/share/nginx && chmod -R ug+rwX /usr/share/nginx && \ chown -R 1001:0 /etc/nginx/conf.d && \ chmod -R ug+rwX /etc/nginx/conf.d RUN touch /var/run/nginx.pid && \ - chown -R 1001:0 /var/run/nginx.pid + chown -R 1001:0 /var/run/nginx.pid && chmod -R ug+rwX /var/run -COPY docker/nginx.conf /etc/nginx/nginx.conf -COPY docker/default.conf /etc/nginx/conf.d/default.conf USER 1001 EXPOSE 8080