From fa4ea018c3a2a008e2797535a2f99abbfca1354c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Wed, 15 Nov 2023 23:02:09 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor=20frontend=20Dock?= =?UTF-8?q?er=20build=20setup,=20use=20plain=20NodeJS,=20use=20custom=20Ng?= =?UTF-8?q?inx=20config,=20fix=20build=20for=20old=20Vue=20(#555)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/.env | 4 ++-- src/frontend/Dockerfile | 6 ++++-- src/frontend/nginx.conf | 11 +++++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 src/frontend/nginx.conf diff --git a/src/.env b/src/.env index 78a3dd6..c422332 100644 --- a/src/.env +++ b/src/.env @@ -6,7 +6,7 @@ DOMAIN=localhost STACK_NAME=full-stack-fastapi-postgresql TRAEFIK_PUBLIC_NETWORK=traefik-public -TRAEFIK_TAG= +TRAEFIK_TAG=traefik TRAEFIK_PUBLIC_TAG=traefik-public # Configure these with your own Docker registry images @@ -16,7 +16,7 @@ DOCKER_IMAGE_FRONTEND=frontend # Backend BACKEND_CORS_ORIGINS="[\"http://localhost\", \"http://localhost:4200\", \"http://localhost:3000\", \"http://localhost:8080\", \"https://localhost\", \"https://localhost:4200\", \"https://localhost:3000\", \"https://localhost:8080\", \"http://local.dockertoolbox.tiangolo.com\", \"http://localhost.tiangolo.com\"]" -PROJECT_NAME= +PROJECT_NAME="Full Stack FastAPI PostgreSQL" SECRET_KEY=changethis FIRST_SUPERUSER=admin@example.com FIRST_SUPERUSER_PASSWORD=changethis diff --git a/src/frontend/Dockerfile b/src/frontend/Dockerfile index 75157e0..5980c12 100644 --- a/src/frontend/Dockerfile +++ b/src/frontend/Dockerfile @@ -1,5 +1,5 @@ # Stage 0, "build-stage", based on Node.js, to build and compile the frontend -FROM tiangolo/node-frontend:10 as build-stage +FROM node:18.12.1 as build-stage WORKDIR /app @@ -13,6 +13,8 @@ ARG FRONTEND_ENV=production ENV VUE_APP_ENV=${FRONTEND_ENV} +ENV NODE_OPTIONS="--openssl-legacy-provider" + # Comment out the next line to disable tests RUN npm run test:unit @@ -24,5 +26,5 @@ FROM nginx:1.15 COPY --from=build-stage /app/dist/ /usr/share/nginx/html -COPY --from=build-stage /nginx.conf /etc/nginx/conf.d/default.conf +COPY ./nginx.conf /etc/nginx/conf.d/default.conf COPY ./nginx-backend-not-found.conf /etc/nginx/extra-conf.d/backend-not-found.conf diff --git a/src/frontend/nginx.conf b/src/frontend/nginx.conf new file mode 100644 index 0000000..ed11d3a --- /dev/null +++ b/src/frontend/nginx.conf @@ -0,0 +1,11 @@ +server { + listen 80; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html =404; + } + + include /etc/nginx/extra-conf.d/*.conf; +}