Three-stage Dockerfile: frontend-build (Node 20), api (Python 3.12 + uvicorn), web (nginx 1.27). nginx.conf proxies /api and /ws to the API service with WebSocket upgrade support. Includes backend/requirements.txt with all Python deps, frontend scaffolding (Vite + React + TypeScript + Tailwind), and placeholder alembic files for Docker COPY compatibility.
44 lines
1.2 KiB
Nginx Configuration File
44 lines
1.2 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Frontend static assets
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# API proxy
|
|
location /api/ {
|
|
proxy_pass http://promptlooper-api:8000;
|
|
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 endpoint proxy
|
|
location /health {
|
|
proxy_pass http://promptlooper-api:8000;
|
|
proxy_set_header Host $host;
|
|
}
|
|
|
|
# WebSocket proxy
|
|
location /ws/ {
|
|
proxy_pass http://promptlooper-api:8000;
|
|
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_read_timeout 86400;
|
|
}
|
|
|
|
# Gzip compression
|
|
gzip on;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript;
|
|
gzip_min_length 256;
|
|
}
|