You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
3.1 KiB
YAML
101 lines
3.1 KiB
YAML
services:
|
|
# PostgreSQL Database
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: stock_oracle_postgres
|
|
environment:
|
|
POSTGRES_USER: stockoracle
|
|
POSTGRES_PASSWORD: stockoracle2024
|
|
POSTGRES_DB: stock_oracle
|
|
ports:
|
|
- "15433:5432" # Unique port to avoid conflicts
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./scripts/init_db.sql:/docker-entrypoint-initdb.d/init.sql
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U stockoracle -d stock_oracle"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
|
|
# Redis Cache
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: stock_oracle_cache
|
|
command: redis-server --appendonly yes --maxmemory 512mb --maxmemory-policy allkeys-lru
|
|
ports:
|
|
- "16380:6379" # Unique port to avoid conflicts
|
|
volumes:
|
|
- redis_data:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
|
|
# FastAPI Application
|
|
api:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: stock_oracle_api
|
|
environment:
|
|
- DATABASE_URL=postgresql+asyncpg://stockoracle:stockoracle2024@postgres:5432/stock_oracle
|
|
- REDIS_URL=redis://redis:6379/0
|
|
- ENVIRONMENT=development
|
|
- DEBUG=True
|
|
- API_PORT=18000
|
|
- SEC_EMAIL=example@example.com
|
|
- ALPACA_API_KEY=${ALPACA_API_KEY:-}
|
|
- ALPACA_SECRET_KEY=${ALPACA_SECRET_KEY:-}
|
|
- ALPHA_VANTAGE_API_KEY=${ALPHA_VANTAGE_API_KEY:-}
|
|
- GOOGLE_TRENDS_ENABLED=true
|
|
ports:
|
|
- "18001:18000" # External:Internal port mapping
|
|
depends_on:
|
|
- postgres
|
|
- redis
|
|
volumes:
|
|
- ./app:/app/app # Mount app directory for development
|
|
- ./alembic:/app/alembic # Mount alembic for live migration access
|
|
- ./alembic.ini:/app/alembic.ini
|
|
- ./stock_oracle_analyzer.py:/app/stock_oracle_analyzer.py
|
|
- ./API_DOCUMENTATION.md:/app/API_DOCUMENTATION.md # API documentation
|
|
- ./yfinance_plus:/app/yfinance_plus # Mount yfinance_plus for development
|
|
- ./data:/app/data # For data files
|
|
mem_limit: 2g
|
|
memswap_limit: 2g
|
|
restart: unless-stopped
|
|
command: ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "18000", "--reload", "--limit-concurrency", "20"]
|
|
|
|
# Frontend Application
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
container_name: stock_oracle_frontend
|
|
environment:
|
|
- NODE_ENV=development
|
|
- NEXT_PUBLIC_API_URL=http://localhost:18001/api/v1
|
|
ports:
|
|
- "18002:3000" # External:Internal port mapping
|
|
volumes:
|
|
- ./frontend:/app # Mount entire frontend directory for development
|
|
- frontend_node_modules:/app/node_modules # Named volume for node_modules
|
|
- frontend_next:/app/.next # Named volume for .next build cache
|
|
depends_on:
|
|
- api
|
|
restart: unless-stopped
|
|
command: ["sh", "-c", "npm ci --legacy-peer-deps && npm run dev"]
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|
|
frontend_node_modules:
|
|
frontend_next:
|
|
|
|
networks:
|
|
default:
|
|
name: stock_oracle_network |