diff --git a/dmp-frontend/Dockerfile b/dmp-frontend/Dockerfile index 7a8d188c9..5bff47629 100644 --- a/dmp-frontend/Dockerfile +++ b/dmp-frontend/Dockerfile @@ -12,7 +12,7 @@ RUN npm install COPY . /page # Build the project and copy the files -RUN npm run ng build -- --deploy-url=/ --prod +RUN npm run ng build -- --prod FROM nginx:alpine diff --git a/dmp-frontend/Dockerfile.CI b/dmp-frontend/Dockerfile.CI index cde3e5199..40d13c999 100644 --- a/dmp-frontend/Dockerfile.CI +++ b/dmp-frontend/Dockerfile.CI @@ -12,20 +12,24 @@ WORKDIR /src COPY . . # Build the project and copy the files -RUN npm run ng build -- --deploy-url=/ --prod +RUN npm run ng build -- --prod +#RUN node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng build -- --deploy-url=/ --prod FROM nginx:alpine #!/bin/sh COPY nginx.conf.CI /etc/nginx/conf.d/default.conf +COPY start_nginx.sh /start_nginx.sh +RUN mkdir -p /tmp/log/nginx + ## Remove default nginx index page RUN rm -rf /usr/share/nginx/html/* -# Copy from the stahg 1 +# Copy from the stage 1 COPY --from=builder /src/dist /usr/share/nginx/html +RUN cp /usr/share/nginx/html/index.html /usr/share/nginx/html/index_base.html EXPOSE 8080 - -ENTRYPOINT ["nginx", "-g", "daemon off;"] \ No newline at end of file +ENTRYPOINT ["sh", "/start_nginx.sh"] \ No newline at end of file diff --git a/dmp-frontend/nginx.conf.CI b/dmp-frontend/nginx.conf.CI index 63cee1859..082050013 100644 --- a/dmp-frontend/nginx.conf.CI +++ b/dmp-frontend/nginx.conf.CI @@ -22,7 +22,14 @@ server { location / { try_files $uri $uri/ /index.html =404; - add_header Cache-Control "no-store, no-cache, must-revalidate"; + } + + location = /index.html { + add_header Cache-Control "no-store, no-cache, must-revalidate"; + } + + location = /assets/config.json { + add_header Cache-Control "no-store, no-cache, must-revalidate"; } } \ No newline at end of file diff --git a/dmp-frontend/start_nginx.sh b/dmp-frontend/start_nginx.sh new file mode 100644 index 000000000..615c88c59 --- /dev/null +++ b/dmp-frontend/start_nginx.sh @@ -0,0 +1,8 @@ +#!/bin/bash +if [[ ! -z "${WEBAPP_BASE_URL}" ]]; then + rm /usr/share/nginx/html/index.html + cp /usr/share/nginx/html/index_base.html /usr/share/nginx/html/index.html + find '/usr/share/nginx/html' -name 'index.html' -exec sed -i -e 's,,,g' {} \; +fi + +nginx -g "daemon off;" \ No newline at end of file