Spaces:
Paused
Paused
File size: 1,706 Bytes
9a546cb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | # Docker Compose for StockSense Agent
# Runs both frontend and backend services together
services:
# FastAPI Backend Service
api:
build:
context: .
dockerfile: Dockerfile.backend
container_name: stocksense-api
ports:
- '8000:8000'
environment:
- GOOGLE_API_KEY=${GOOGLE_API_KEY}
- NEWSAPI_KEY=${NEWSAPI_KEY}
- DATABASE_URL=sqlite:///data/stocksense.db
volumes:
- api_data:/app/data
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:8000/health']
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- stocksense-network
# Streamlit Frontend Service
frontend:
build:
context: .
dockerfile: Dockerfile.frontend
container_name: stocksense-frontend
ports:
- '8501:8501'
environment:
- GOOGLE_API_KEY=${GOOGLE_API_KEY}
- NEWSAPI_KEY=${NEWSAPI_KEY}
- API_BASE_URL=http://api:8000
depends_on:
api:
condition: service_healthy
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:8501/_stcore/health']
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- stocksense-network
# Nginx Reverse Proxy (Optional)
nginx:
image: nginx:alpine
container_name: stocksense-proxy
ports:
- '80:80'
- '443:443'
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- frontend
- api
networks:
- stocksense-network
# Named volumes for data persistence
volumes:
api_data:
driver: local
# Custom network for service communication
networks:
stocksense-network:
driver: bridge
|