From 7e9f044b67a17cee72bd914fbba293e7f566ef6e Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Tue, 5 Nov 2024 18:04:56 +0000 Subject: [PATCH] build: restructure / simplify frontend docker volumes --- docker-compose.development.yml | 8 ++------ docker-compose.main.yml | 8 ++------ nginx/templates/fmtm.conf.template | 4 ++-- src/Dockerfile.ui.prod | 4 ++-- src/container-entrypoint.sh | 3 ++- 5 files changed, 10 insertions(+), 17 deletions(-) diff --git a/docker-compose.development.yml b/docker-compose.development.yml index 5d341b0122..86685d1346 100644 --- a/docker-compose.development.yml +++ b/docker-compose.development.yml @@ -20,8 +20,6 @@ name: fmtm-dev volumes: fmtm_frontend: name: fmtm-frontend-${GIT_BRANCH} - fmtm_mapper_frontend: - name: fmtm-mapper-frontend-${GIT_BRANCH} fmtm_db_data: name: fmtm-db-data-${GIT_BRANCH} fmtm_data: @@ -62,8 +60,7 @@ services: ui: condition: service_completed_successfully volumes: - - fmtm_frontend:/usr/share/nginx/html/fmtm-manager/ - - fmtm_frontend:/usr/share/nginx/html/fmtm-mapper/ + - fmtm_frontend:/usr/share/nginx/html/fmtm - central_frontend:/usr/share/nginx/html/central/ - certs:/etc/letsencrypt - certbot_data:/var/www/certbot @@ -124,8 +121,7 @@ services: VITE_API_URL: https://${FMTM_API_DOMAIN:-api.${FMTM_DOMAIN}} NODE_ENV: development volumes: - - fmtm_frontend:/frontend/fmtm-manager - - fmtm_mapper_frontend:/frontend/fmtm-mapper + - fmtm_frontend:/frontend network_mode: none restart: "on-failure:2" diff --git a/docker-compose.main.yml b/docker-compose.main.yml index 93de885d07..7d082399e5 100644 --- a/docker-compose.main.yml +++ b/docker-compose.main.yml @@ -20,8 +20,6 @@ name: fmtm-main volumes: fmtm_frontend: name: fmtm-frontend-main - fmtm_mapper_frontend: - name: fmtm-mapper-frontend-main fmtm_db_data: name: fmtm-db-data-main fmtm_data: @@ -54,8 +52,7 @@ services: ui: condition: service_completed_successfully volumes: - - fmtm_frontend:/usr/share/nginx/html/fmtm-manager/ - - fmtm_frontend:/usr/share/nginx/html/fmtm-mapper/ + - fmtm_frontend:/usr/share/nginx/html/fmtm - certs:/etc/letsencrypt - certbot_data:/var/www/certbot environment: @@ -114,8 +111,7 @@ services: VITE_API_URL: https://${FMTM_API_DOMAIN:-api.${FMTM_DOMAIN}} NODE_ENV: production volumes: - - fmtm_frontend:/frontend/fmtm-manager - - fmtm_mapper_frontend:/frontend/fmtm-mapper + - fmtm_frontend:/frontend network_mode: none restart: "on-failure:2" diff --git a/nginx/templates/fmtm.conf.template b/nginx/templates/fmtm.conf.template index ed9a6a5f7e..2f38e540eb 100644 --- a/nginx/templates/fmtm.conf.template +++ b/nginx/templates/fmtm.conf.template @@ -41,13 +41,13 @@ server { location /mapnow { # Serve FMTM mapper frontend under /usr/share/nginx/html - root /usr/share/nginx/html/fmtm-mapper; + root /usr/share/nginx/html/fmtm/mapper; try_files $uri $uri/ /index.html; } location / { # Serve FMTM management frontend under /usr/share/nginx/html - root /usr/share/nginx/html/fmtm-manager; + root /usr/share/nginx/html/fmtm/manager; try_files $uri $uri/ /index.html; } diff --git a/src/Dockerfile.ui.prod b/src/Dockerfile.ui.prod index 6f77812420..9f9f9ea295 100644 --- a/src/Dockerfile.ui.prod +++ b/src/Dockerfile.ui.prod @@ -37,5 +37,5 @@ COPY container-entrypoint.sh / RUN chmod +x /container-entrypoint.sh ENTRYPOINT ["/container-entrypoint.sh"] WORKDIR /app -COPY --from=manager-frontend /app/dist ./manager-frontend -COPY --from=mapper-frontend /app/build ./mapper-frontend +COPY --from=manager-frontend /app/dist ./manager +COPY --from=mapper-frontend /app/build ./mapper diff --git a/src/container-entrypoint.sh b/src/container-entrypoint.sh index cca44b6b70..581c61c3f9 100644 --- a/src/container-entrypoint.sh +++ b/src/container-entrypoint.sh @@ -2,7 +2,8 @@ set -e -# Copy frontend to attached volume +# Copy frontend to attached volume, making it +# accessible to the Nginx container echo "Syncing files from /app --> /frontend." rclone sync /app /frontend echo "Sync done."