From f7e2901d4aed390bd604ae1af718b0ab26f3639d Mon Sep 17 00:00:00 2001 From: liberty-rising Date: Fri, 5 Jan 2024 22:10:28 +0100 Subject: [PATCH 1/3] rename nginx.conf used for development --- docker-compose.yml | 2 +- nginx.conf => nginx.dev.conf | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename nginx.conf => nginx.dev.conf (100%) diff --git a/docker-compose.yml b/docker-compose.yml index 9e18f31..fe9f0c2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,7 +23,7 @@ services: ports: - "443:443" volumes: - - ./nginx.conf:/etc/nginx/nginx.conf:ro + - ./nginx.dev.conf:/etc/nginx/nginx.conf:ro - ./certs:/etc/nginx/certs:ro depends_on: - backend diff --git a/nginx.conf b/nginx.dev.conf similarity index 100% rename from nginx.conf rename to nginx.dev.conf From 8fe94b00892d260a28e5a434c6067da3873a85ff Mon Sep 17 00:00:00 2001 From: liberty-rising Date: Fri, 5 Jan 2024 22:13:43 +0100 Subject: [PATCH 2/3] create prod nginx config for compatibility with single page application --- nginx.prod.conf | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 nginx.prod.conf diff --git a/nginx.prod.conf b/nginx.prod.conf new file mode 100644 index 0000000..60d2005 --- /dev/null +++ b/nginx.prod.conf @@ -0,0 +1,9 @@ +server { + listen 80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + try_files $uri $uri/ /index.html; + } +} \ No newline at end of file From e3b95758a2e7cbb212347dd952299d2150b55926 Mon Sep 17 00:00:00 2001 From: liberty-rising Date: Fri, 5 Jan 2024 22:14:43 +0100 Subject: [PATCH 3/3] update frontend Dockerfile to use nginx configuration --- frontend/Dockerfile.prod | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/Dockerfile.prod b/frontend/Dockerfile.prod index 4fd9bcb..f87c5f0 100644 --- a/frontend/Dockerfile.prod +++ b/frontend/Dockerfile.prod @@ -17,6 +17,9 @@ RUN npm run build # Stage 2: Serve the app with Nginx FROM nginx:stable-alpine3.17 +# Copy the custom Nginx configuration +COPY nginx.prod.conf /etc/nginx/conf.d/default.conf + # Copy the build output to replace the default nginx contents. COPY --from=build /app/dist /usr/share/nginx/html