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.

156 lines
3.7 KiB
YAML

version: '3.8'
services:
# PostgreSQL Database
postgres:
image: postgres:15
container_name: stock-oracle-postgres
environment:
POSTGRES_DB: stock_oracle
POSTGRES_USER: stock_oracle_user
POSTGRES_PASSWORD: stock_oracle_password
TZ: Asia/Seoul
volumes:
- postgres_data:/var/lib/postgresql/data
- ./init.sql:/docker-entrypoint-initdb.d/init.sql:ro
ports:
- "15433:5432"
networks:
- stock-oracle-network
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U stock_oracle_user -d stock_oracle"]
interval: 30s
timeout: 10s
retries: 3
# Redis Cache
redis:
image: redis:7-alpine
container_name: stock-oracle-redis
command: redis-server --appendonly yes --requirepass redis_password
volumes:
- redis_data:/data
ports:
- "16380:6379"
networks:
- stock-oracle-network
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "-a", "redis_password", "ping"]
interval: 30s
timeout: 10s
retries: 3
# Stock Oracle API
api:
image: stock-oracle-api:latest
container_name: stock-oracle-api
build:
context: ..
dockerfile: Dockerfile
environment:
# Database Configuration
DATABASE_URL: postgresql+asyncpg://stock_oracle_user:stock_oracle_password@postgres:5432/stock_oracle
# Redis Configuration
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_PASSWORD: redis_password
# API Configuration
API_TITLE: Stock Oracle API
API_VERSION: 1.0.0
DEBUG: false
# External API Keys
SEC_EMAIL: ${SEC_EMAIL:-your-email@example.com}
ALPHA_VANTAGE_API_KEY: ${ALPHA_VANTAGE_API_KEY:-}
# Timezone
TZ: Asia/Seoul
ports:
- "18001:8000"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- stock-oracle-network
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/docs"]
interval: 30s
timeout: 10s
retries: 3
volumes:
- api_logs:/app/logs
- yfinance_plus_src:/app/yfinance_plus
# Stock Oracle Frontend
frontend:
image: stock-oracle-frontend:latest
container_name: stock-oracle-frontend
build:
context: ../frontend
dockerfile: Dockerfile
environment:
# API Configuration
NEXT_PUBLIC_API_URL: http://api:8000/api/v1
# Application Configuration
NEXT_PUBLIC_APP_NAME: Stock Oracle
NEXT_PUBLIC_APP_VERSION: 1.0.0
# Node Environment
NODE_ENV: production
ports:
- "3000:3000"
depends_on:
- api
networks:
- stock-oracle-network
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000"]
interval: 30s
timeout: 10s
retries: 3
# Nginx Reverse Proxy
nginx:
image: nginx:alpine
container_name: stock-oracle-nginx
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx-full.conf:/etc/nginx/nginx.conf:ro
- ./nginx/ssl:/etc/nginx/ssl:ro
- nginx_logs:/var/log/nginx
depends_on:
- api
- frontend
networks:
- stock-oracle-network
restart: unless-stopped
volumes:
postgres_data:
name: stock-oracle-postgres-data
redis_data:
name: stock-oracle-redis-data
api_logs:
name: stock-oracle-api-logs
yfinance_plus_src:
name: stock-oracle-yfinance-plus
nginx_logs:
name: stock-oracle-nginx-logs
networks:
stock-oracle-network:
name: stock-oracle-network
driver: bridge