chore: consolidate to single Docker container
Replace two-container setup (separate backend + nginx frontend) with a single image that runs both via supervisord: - New Dockerfile: Node stage builds React, Python+nginx stage is the runtime - supervisord.conf: manages uvicorn (api_server.py) + nginx as sibling procs - nginx.conf: proxy_pass updated to localhost:8000 (same container) - docker-compose.yml: simplified to one service on port 80 Deploy: docker-compose up -d # or docker build -t flight-radar . && docker run -p 80:80 flight-radar Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,54 +1,15 @@
|
||||
services:
|
||||
# Backend API Server
|
||||
backend:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.backend
|
||||
container_name: flight-radar-backend
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8000:8000"
|
||||
environment:
|
||||
- PORT=8000
|
||||
- DATABASE_PATH=/app/data/cache.db
|
||||
- ALLOWED_ORIGINS=http://localhost,http://localhost:80,http://frontend
|
||||
volumes:
|
||||
- backend-data:/app/data
|
||||
- ./cache.db:/app/cache.db:rw
|
||||
networks:
|
||||
- flight-radar-network
|
||||
healthcheck:
|
||||
test: ["CMD", "python", "-c", "import requests; requests.get('http://localhost:8000/health').raise_for_status()"]
|
||||
interval: 30s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
|
||||
# Frontend UI
|
||||
frontend:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.frontend
|
||||
container_name: flight-radar-frontend
|
||||
app:
|
||||
build: .
|
||||
container_name: flight-radar
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "80:80"
|
||||
depends_on:
|
||||
backend:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- flight-radar-network
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost/"]
|
||||
interval: 30s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
start_period: 5s
|
||||
|
||||
networks:
|
||||
flight-radar-network:
|
||||
driver: bridge
|
||||
environment:
|
||||
- DATABASE_PATH=/app/data/cache.db
|
||||
volumes:
|
||||
- flight-radar-data:/app/data
|
||||
|
||||
volumes:
|
||||
backend-data:
|
||||
flight-radar-data:
|
||||
driver: local
|
||||
|
||||
Reference in New Issue
Block a user