- Backend Dockerfile: added curl install for health check (not in aspnet base image) - Frontend Dockerfile: multi-stage Angular build with nginx serving - Frontend nginx.conf: SPA routing, API proxy, SignalR WebSocket support, health endpoint - Frontend .dockerignore: excludes node_modules, dist, .angular, etc. - docker-compose.dev.yml: added PostgreSQL service, fixed frontend context path, renamed web service from control-center-web to extrudex-web, added DB env vars, proper service dependencies with health checks - deploy.sh: updated service list to include PostgreSQL port
54 lines
1.6 KiB
Nginx Configuration File
54 lines
1.6 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name _;
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Gzip compression
|
|
gzip on;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript;
|
|
gzip_min_length 256;
|
|
|
|
# Angular SPA — fallback to index.html for client-side routing
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# Cache static assets aggressively
|
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?|ttf|eot)$ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
# Proxy API requests to backend
|
|
# Uses resolver so nginx doesn't crash if backend isn't available at startup
|
|
resolver 127.0.0.11 valid=30s ipv6=off;
|
|
set $backend "extrudex-api:8080";
|
|
|
|
location /api/ {
|
|
proxy_pass http://$backend;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
}
|
|
|
|
# SignalR WebSocket support
|
|
location /hubs/ {
|
|
proxy_pass http://$backend;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
}
|
|
|
|
# Health check endpoint
|
|
location /health {
|
|
access_log off;
|
|
return 200 "ok";
|
|
add_header Content-Type text/plain;
|
|
}
|
|
} |