feat(docker/frontend): make backend URL configurable via env

This commit is contained in:
Alphaeus Mote
2025-11-19 09:34:34 -05:00
parent f7c349d4a8
commit 96fcd793f1
4 changed files with 8 additions and 3 deletions
+2
View File
@@ -14,5 +14,7 @@ FRONTEND_IMAGENAME=Agit8or/Depl0y-frontend
FRONTEND_IMAGEVERSION=latest FRONTEND_IMAGEVERSION=latest
FRONTEND_ENABLEAUTOMATICUPDATES=true FRONTEND_ENABLEAUTOMATICUPDATES=true
FRONTEND_PORT_EXTERNAL=8080 FRONTEND_PORT_EXTERNAL=8080
BACKEND_BASEURL=http://backend:8000
###END FRONTEND### ###END FRONTEND###
+2 -1
View File
@@ -8,7 +8,8 @@ ENV APP_VERSION=${APP_VERSION}
COPY src/frontend/dist /usr/share/nginx/html COPY src/frontend/dist /usr/share/nginx/html
# Custom nginx config for SPA routing (serve index.html for unknown routes) # Custom nginx config for SPA routing (serve index.html for unknown routes)
COPY deployment/docker/frontend/nginx.conf /etc/nginx/conf.d/default.conf # Use nginx's built-in template support to env-substitute BACKEND_BASEURL
COPY deployment/docker/frontend/nginx.conf /etc/nginx/templates/default.conf.template
EXPOSE 80 EXPOSE 80
@@ -19,6 +19,8 @@ services:
logging: logging:
driver: 'local' driver: 'local'
#env_file: '.env' #env_file: '.env'
environment:
BACKEND_BASEURL: '${BACKEND_BASEURL:-http://backend:8000}'
networks: networks:
EXTERNAL: EXTERNAL:
ports: ports:
+2 -2
View File
@@ -10,9 +10,9 @@ server {
try_files $uri /index.html; try_files $uri /index.html;
} }
# Backend API - expects a backend service reachable at http://backend:8000 # Backend API - configurable via BACKEND_BASEURL (e.g. http://backend:8000)
location /api { location /api {
proxy_pass http://backend:8000; proxy_pass $BACKEND_BASEURL;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade'; proxy_set_header Connection 'upgrade';