feat(frontend): make API endpoint configurable via environment variable
Use nginx template support to allow API_URL to be passed at container runtime, enabling the same image to be deployed to different environments. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+5
-2
@@ -21,8 +21,11 @@ FROM nginx:alpine
|
|||||||
# Copy built files
|
# Copy built files
|
||||||
COPY --from=build /app/dist /usr/share/nginx/html
|
COPY --from=build /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
# Copy nginx config
|
# Copy nginx template (processed at startup with envsubst)
|
||||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
COPY nginx.conf.template /etc/nginx/templates/default.conf.template
|
||||||
|
|
||||||
|
# Default API URL (override with -e API_URL=...)
|
||||||
|
ENV API_URL=http://api:8000/
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ server {
|
|||||||
|
|
||||||
# Proxy API requests to backend
|
# Proxy API requests to backend
|
||||||
location /api/ {
|
location /api/ {
|
||||||
proxy_pass http://api:8000/;
|
proxy_pass ${API_URL};
|
||||||
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';
|
||||||
Reference in New Issue
Block a user