64 lines
1.7 KiB
YAML
64 lines
1.7 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# MySQL数据库
|
|
mysql:
|
|
image: mysql:8.0
|
|
container_name: employee-performance-mysql
|
|
restart: unless-stopped
|
|
environment:
|
|
MYSQL_ROOT_PASSWORD: rootpassword123
|
|
MYSQL_DATABASE: employee_performance
|
|
MYSQL_USER: performance_user
|
|
MYSQL_PASSWORD: userpassword123
|
|
ports:
|
|
- "3306:3306"
|
|
volumes:
|
|
- mysql_data:/var/lib/mysql
|
|
- ./backend/src/db/init.sql:/docker-entrypoint-initdb.d/init.sql
|
|
- ./backend/src/db/seed.sql:/docker-entrypoint-initdb.d/seed.sql
|
|
healthcheck:
|
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-uroot", "-prootpassword123"]
|
|
timeout: 20s
|
|
retries: 10
|
|
start_period: 30s
|
|
networks:
|
|
- performance-network
|
|
|
|
# 后端应用
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
container_name: employee-performance-backend
|
|
restart: unless-stopped
|
|
environment:
|
|
DB_HOST: mysql
|
|
DB_PORT: 3306
|
|
DB_USER: performance_user
|
|
DB_PASSWORD: userpassword123
|
|
DB_NAME: employee_performance
|
|
JWT_SECRET: your_jwt_secret_here_change_in_production
|
|
FASTGPT_API_KEY: your_fastgpt_api_key_here
|
|
FASTGPT_API_URL: https://api.fastgpt.in/api/v1/chat/completions
|
|
FASTGPT_MODEL: gpt-4
|
|
PORT: 3001
|
|
NODE_ENV: production
|
|
ports:
|
|
- "3001:3001"
|
|
depends_on:
|
|
mysql:
|
|
condition: service_healthy
|
|
networks:
|
|
- performance-network
|
|
# 如果需要在容器内运行数据库初始化脚本,可以取消下面的注释
|
|
# volumes:
|
|
# - ./backend/src/db:/app/src/db:ro
|
|
|
|
networks:
|
|
performance-network:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
mysql_data:
|
|
driver: local |