scratch_chat / docker-compose.yml
WebashalarForML's picture
Upload 178 files
330b6e4 verified
version: '3.8'
services:
# Main chat agent application
chat-agent:
build: .
ports:
- "5000:5000"
environment:
- FLASK_ENV=production
- DATABASE_URL=postgresql://chatuser:chatpass@postgres:5432/chat_agent_db
- REDIS_URL=redis://redis:6379/0
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- ./logs:/app/logs
restart: unless-stopped
networks:
- chat-network
# PostgreSQL database
postgres:
image: postgres:15-alpine
environment:
POSTGRES_DB: chat_agent_db
POSTGRES_USER: chatuser
POSTGRES_PASSWORD: chatpass
volumes:
- postgres_data:/var/lib/postgresql/data
- ./migrations:/docker-entrypoint-initdb.d
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U chatuser -d chat_agent_db"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
networks:
- chat-network
# Redis for caching and sessions
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
networks:
- chat-network
# Nginx reverse proxy (optional, for production)
nginx:
image: nginx:alpine
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./ssl:/etc/nginx/ssl:ro
depends_on:
- chat-agent
restart: unless-stopped
networks:
- chat-network
profiles:
- production
volumes:
postgres_data:
redis_data:
networks:
chat-network:
driver: bridge