From 8981d07ed6b108cd9eed9153ba5422711f7d453e Mon Sep 17 00:00:00 2001 From: Timo Bejan Date: Tue, 22 Sep 2020 14:53:41 +0300 Subject: [PATCH] changed nginx to proxy to API_URL --- .../{default.conf => nginx.conf.template} | 18 ++++++++++++++++++ docker/red-ui/Dockerfile | 4 +++- docker/red-ui/docker-entrypoint.sh | 2 ++ 3 files changed, 23 insertions(+), 1 deletion(-) rename docker/common/nginx/{default.conf => nginx.conf.template} (62%) diff --git a/docker/common/nginx/default.conf b/docker/common/nginx/nginx.conf.template similarity index 62% rename from docker/common/nginx/default.conf rename to docker/common/nginx/nginx.conf.template index 7bbea1030..1d40db982 100644 --- a/docker/common/nginx/default.conf +++ b/docker/common/nginx/nginx.conf.template @@ -8,6 +8,24 @@ server { proxy_hide_header WWW-Authenticate; try_files $uri$args $uri$args/ $uri $uri/ /index.html =404; } + location /project { + proxy_pass $API_URL + } + location /reanalyse { + proxy_pass $API_URL + } + location /upload { + proxy_pass $API_URL + } + location /download { + proxy_pass $API_URL + } + location /delete { + proxy_pass $API_URL + } + location /status { + proxy_pass $API_URL + } gzip_min_length 1000; gzip on; gzip_http_version 1.0; diff --git a/docker/red-ui/Dockerfile b/docker/red-ui/Dockerfile index d4edef844..607507eec 100644 --- a/docker/red-ui/Dockerfile +++ b/docker/red-ui/Dockerfile @@ -21,12 +21,14 @@ RUN yarn build --prod --project=red-ui FROM nginx:1.17.6-alpine ## Copy our default nginx config -COPY docker/common/nginx/default.conf /etc/nginx/conf.d/ +COPY docker/common/nginx/ngix.conf.template /ngix.conf.templat ## Remove default nginx website RUN rm -rf /usr/share/nginx/html/* ## From ‘builder’ stage copy over the artifacts in dist folder to default nginx public folder COPY --from=builder /ng-app/dist/apps/red-ui /usr/share/nginx/html +RUN chmod o+r -R /usr/share/nginx/html +RUN chmod g+r -R /usr/share/nginx/html COPY docker/red-ui/docker-entrypoint.sh / CMD ["/docker-entrypoint.sh"] diff --git a/docker/red-ui/docker-entrypoint.sh b/docker/red-ui/docker-entrypoint.sh index e21f8d703..4535277b6 100755 --- a/docker/red-ui/docker-entrypoint.sh +++ b/docker/red-ui/docker-entrypoint.sh @@ -13,3 +13,5 @@ echo '{ }' > /usr/share/nginx/html/assets/config/config.json nginx -g 'daemon off;' + +envsubst '$API_URL' < /nginx.conf.template > /etc/nginx/nginx.conf && exec nginx -g 'daemon off;'"]