diff --git a/Dockerfile b/Dockerfile index e441522eaa3c42fcc3a37fb1630c76a7ac5ddeb2..4c01be6ed40c7f612f38f0baac77caefa1f7b15d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,14 @@ WORKDIR /app # Install npm dependencies RUN npm install # Copy the project -COPY . /app +COPY tsconfig.json /app +COPY angular.json /app +COPY patch.js /app +COPY config /app/config +COPY src /app/src + +RUN ls /app + # Launch postinstall script (to include crypto module) RUN npm run postinstall @@ -20,7 +27,13 @@ RUN npm run build:${conf} # Stage 1, based on Nginx, to have only the compiled app FROM nginx -COPY --from=builder /app/dist/admin-gui /usr/share/nginx/html +## Install dependency to get lua module in .conf +RUN apt-get update +RUN apt-get --assume-yes install nginx-extras + +RUN rm /etc/nginx/conf.d/* + +COPY --from=builder /app/dist/admin-gui /usr/share/nginx/html/admin RUN ls -l /usr/share/nginx/html EXPOSE 80 diff --git a/angular.json b/angular.json index 5aa6d59eea85e65b91f7b0fbd2baf7bcdec606e6..df87937930cdf8f05453aa7ec2f5d75fa1d65ce1 100644 --- a/angular.json +++ b/angular.json @@ -145,4 +145,4 @@ "prefix": "app" } } -} \ No newline at end of file +} diff --git a/docker-compose.yml b/docker-compose.yml index 1efb1d4d92a653ccefbca2a592d86f481a1b99aa..03095beba329f36c5c45b580c803562a97c072ed 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,9 +5,9 @@ services: build: . image: registry.alpha.grandlyon.com/refonte-data/admin-gui:${TAG} volumes: - - ./nginx.conf.template:/etc/nginx/conf.d/default.conf - - ${CONFIG_FILE_PATH}:/usr/share/nginx/html/assets/config/config.json + - ${PWD}/nginx.conf.template:/etc/nginx/sites-enabled/default:ro + - ${CONFIG_FILE_PATH}:/usr/share/nginx/html/assets/config/config.json:ro ports: - - ${APP_PORT}:80 + - ${APP_PORT}:8080 restart: unless-stopped - \ No newline at end of file + diff --git a/nginx.conf.template b/nginx.conf.template index 83591b0ca68959f042fa5ff5d60004546b16099a..d7ea65b60ce50a9da2543106fbdbc375b31c8736 100644 --- a/nginx.conf.template +++ b/nginx.conf.template @@ -1,14 +1,16 @@ server { - # staging server is listening on the port 8080 - listen 80 ; + listen 8080; server_name _; root /usr/share/nginx/html/; - location /admin { - try_files $uri$args /index.html; + location /admin/ { + try_files $uri$args /admin/index.html; + } location / { - ngx.redirect("/admin/") - } + rewrite_by_lua ' + ngx.redirect("/admin/") + '; + } }