From 72eba2a027b429072b59cae98971114a5784fca4 Mon Sep 17 00:00:00 2001 From: simvalery Date: Tue, 19 Jul 2022 16:39:11 +0300 Subject: [PATCH] fix publishing docker images Signed-off-by: simvalery --- web-proxy/Dockerfile.ci | 18 ++++++++++++++++++ web-proxy/configs/image.conf | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 web-proxy/Dockerfile.ci create mode 100644 web-proxy/configs/image.conf diff --git a/web-proxy/Dockerfile.ci b/web-proxy/Dockerfile.ci new file mode 100644 index 0000000000..679cc019a9 --- /dev/null +++ b/web-proxy/Dockerfile.ci @@ -0,0 +1,18 @@ +FROM node:16 as frontendBuilder +WORKDIR /usr/local/interfaces +COPY ./interfaces/package*.json /usr/local/interfaces/ +COPY ./interfaces/tsconfig.json /usr/local/interfaces/ +RUN npm install +ADD ./interfaces/src/ /usr/local/interfaces/src/. +RUN npm run build +WORKDIR /usr/local/frontend +COPY ./frontend/. /usr/local/frontend +RUN npm install +RUN npm run build + +FROM nginx:latest +ENV PLATFORM="docker" +COPY ./web-proxy/configs/default.conf /etc/nginx/conf.d/image.conf +COPY --from=frontendBuilder /usr/local/frontend/dist/guardian /usr/share/nginx/html + +EXPOSE 80 diff --git a/web-proxy/configs/image.conf b/web-proxy/configs/image.conf new file mode 100644 index 0000000000..476714b37a --- /dev/null +++ b/web-proxy/configs/image.conf @@ -0,0 +1,35 @@ +server { + listen 80; + listen [::]:80; + server_name localhost; + + location /ws/ { + proxy_pass http://$ENV{"GATEWAY_HOST"}:$ENV{"GATEWAY_PORT"}; + proxy_set_header Host $host; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_read_timeout 600s; + } + + location /api/v1/ { + proxy_pass http://$ENV{"GATEWAY_HOST"}:$ENV{"GATEWAY_PORT"}/; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Surrogate-Control no-store; + proxy_set_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate"; + proxy_set_header Pragma no-cache; + proxy_set_header Expires 0; + proxy_redirect off; + proxy_read_timeout 600s; + proxy_connect_timeout 600s; + proxy_send_timeout 600s; + } + + location / { + root /usr/share/nginx/html; + try_files $uri $uri/ /index.html; + } +}