ci changes

This commit is contained in:
Diamantis Tziotzios 2021-01-22 10:32:07 +02:00
parent f30392864c
commit 3a27f66dc5
4 changed files with 25 additions and 6 deletions

View File

@ -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

View File

@ -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;"]
ENTRYPOINT ["sh", "/start_nginx.sh"]

View File

@ -22,6 +22,13 @@ server {
location / {
try_files $uri $uri/ /index.html =404;
}
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";
}

View File

@ -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,<base href="/">,<base href="'"$WEBAPP_BASE_URL"'">,g' {} \;
fi
nginx -g "daemon off;"