| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- version: '3.8'
- services:
- # PostgreSQL 数据库
- postgres:
- image: postgres:16-alpine
- container_name: lingyue-postgres
- restart: unless-stopped
- environment:
- POSTGRES_DB: lingyue_zhibao
- POSTGRES_USER: postgres
- POSTGRES_PASSWORD: postgres123
- POSTGRES_INITDB_ARGS: "--encoding=UTF-8"
- ports:
- - "5432:5432"
- volumes:
- - postgres_data:/var/lib/postgresql/data
- - ./backend/sql:/docker-entrypoint-initdb.d
- networks:
- - lingyue-network
- healthcheck:
- test: ["CMD-SHELL", "pg_isready -U postgres"]
- interval: 10s
- timeout: 5s
- retries: 5
- # Redis 缓存
- redis:
- image: redis:7-alpine
- container_name: lingyue-redis
- restart: unless-stopped
- command: redis-server --appendonly yes
- ports:
- - "6379:6379"
- volumes:
- - redis_data:/data
- networks:
- - lingyue-network
- healthcheck:
- test: ["CMD", "redis-cli", "ping"]
- interval: 10s
- timeout: 3s
- retries: 5
- # RabbitMQ 消息队列
- rabbitmq:
- image: rabbitmq:3.13-management-alpine
- container_name: lingyue-rabbitmq
- restart: unless-stopped
- environment:
- RABBITMQ_DEFAULT_USER: admin
- RABBITMQ_DEFAULT_PASS: admin123
- ports:
- - "5672:5672" # AMQP 端口
- - "15672:15672" # 管理界面端口
- volumes:
- - rabbitmq_data:/var/lib/rabbitmq
- networks:
- - lingyue-network
- healthcheck:
- test: ["CMD", "rabbitmq-diagnostics", "ping"]
- interval: 10s
- timeout: 5s
- retries: 5
- # 灵越智报应用
- lingyue-app:
- build:
- context: ./backend
- dockerfile: Dockerfile
- container_name: lingyue-app
- restart: unless-stopped
- ports:
- - "8000:8000"
- environment:
- # 数据库配置
- DB_USERNAME: postgres
- DB_PASSWORD: postgres123
- # Redis 配置
- REDIS_HOST: redis
- REDIS_PORT: 6379
- REDIS_PASSWORD: ""
- # RabbitMQ 配置
- RABBITMQ_HOST: rabbitmq
- RABBITMQ_PORT: 5672
- RABBITMQ_USERNAME: admin
- RABBITMQ_PASSWORD: admin123
- # JWT 配置
- JWT_SECRET: lingyue-zhibao-production-secret-key-please-change-this-in-production-environment
- # PaddleOCR 配置
- PADDLEOCR_SERVER_URL: http://paddleocr:8866
- # DeepSeek API 配置 (需要自行配置)
- DEEPSEEK_API_KEY: ${DEEPSEEK_API_KEY:-}
- volumes:
- - app_data:/tmp/lingyue-zhibao
- - app_logs:/app/logs
- networks:
- - lingyue-network
- depends_on:
- postgres:
- condition: service_healthy
- redis:
- condition: service_healthy
- rabbitmq:
- condition: service_healthy
- healthcheck:
- test: ["CMD", "curl", "-f", "http://localhost:8000/actuator/health"]
- interval: 30s
- timeout: 10s
- retries: 3
- start_period: 60s
- # PaddleOCR 服务(可选)
- paddleocr:
- image: paddlepaddle/paddleocr:latest-cpu
- container_name: lingyue-paddleocr
- restart: unless-stopped
- ports:
- - "8866:8866"
- networks:
- - lingyue-network
- profiles:
- - with-ocr
- volumes:
- postgres_data:
- driver: local
- redis_data:
- driver: local
- rabbitmq_data:
- driver: local
- app_data:
- driver: local
- app_logs:
- driver: local
- networks:
- lingyue-network:
- driver: bridge
|