Skip to content

Commit

Permalink
build: restructure / simplify frontend docker volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Nov 5, 2024
1 parent f0da658 commit 7e9f044
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 17 deletions.
8 changes: 2 additions & 6 deletions docker-compose.development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"

Expand Down
8 changes: 2 additions & 6 deletions docker-compose.main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"

Expand Down
4 changes: 2 additions & 2 deletions nginx/templates/fmtm.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Dockerfile.ui.prod
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion src/container-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit 7e9f044

Please sign in to comment.