You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
1.8 KiB
83 lines
1.8 KiB
|
3 months ago
|
version: '3.8'
|
||
|
|
|
||
|
|
services:
|
||
|
|
# 后端应用
|
||
|
|
app:
|
||
|
|
build: .
|
||
|
|
ports:
|
||
|
|
- "3000:3000"
|
||
|
|
environment:
|
||
|
|
- NODE_ENV=production
|
||
|
|
- PORT=3000
|
||
|
|
- DATABASE_URL=mysql://root:rootpass@mysql:3306/aguzhitou
|
||
|
|
- REDIS_URL=redis://redis:6379
|
||
|
|
- JWT_SECRET=${JWT_SECRET:-your-secret-key-min-32-characters-long}
|
||
|
|
- JWT_EXPIRES_IN=7d
|
||
|
|
- LOG_LEVEL=info
|
||
|
|
- AKSHARE_URL=http://akshare:8000
|
||
|
|
depends_on:
|
||
|
|
mysql:
|
||
|
|
condition: service_healthy
|
||
|
|
redis:
|
||
|
|
condition: service_healthy
|
||
|
|
volumes:
|
||
|
|
- ./logs:/app/logs
|
||
|
|
restart: always
|
||
|
|
networks:
|
||
|
|
- aguzhitou-network
|
||
|
|
|
||
|
|
# MySQL 数据库
|
||
|
|
mysql:
|
||
|
|
image: mysql:8.0
|
||
|
|
environment:
|
||
|
|
- MYSQL_ROOT_PASSWORD=rootpass
|
||
|
|
- MYSQL_DATABASE=aguzhitou
|
||
|
|
- MYSQL_CHARSET=utf8mb4
|
||
|
|
- MYSQL_COLLATION=utf8mb4_unicode_ci
|
||
|
|
volumes:
|
||
|
|
- mysql_data:/var/lib/mysql
|
||
|
|
ports:
|
||
|
|
- "3306:3306"
|
||
|
|
healthcheck:
|
||
|
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-prootpass"]
|
||
|
|
interval: 10s
|
||
|
|
timeout: 5s
|
||
|
|
retries: 5
|
||
|
|
restart: always
|
||
|
|
networks:
|
||
|
|
- aguzhitou-network
|
||
|
|
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||
|
|
|
||
|
|
# Redis 缓存
|
||
|
|
redis:
|
||
|
|
image: redis:7-alpine
|
||
|
|
volumes:
|
||
|
|
- redis_data:/data
|
||
|
|
ports:
|
||
|
|
- "6379:6379"
|
||
|
|
healthcheck:
|
||
|
|
test: ["CMD", "redis-cli", "ping"]
|
||
|
|
interval: 10s
|
||
|
|
timeout: 5s
|
||
|
|
retries: 5
|
||
|
|
restart: always
|
||
|
|
networks:
|
||
|
|
- aguzhitou-network
|
||
|
|
|
||
|
|
# AKShare 数据服务(可选)
|
||
|
|
akshare:
|
||
|
|
image: registry.cn-shanghai.aliyuncs.com/akshare/akshare:latest
|
||
|
|
ports:
|
||
|
|
- "8000:8000"
|
||
|
|
restart: always
|
||
|
|
networks:
|
||
|
|
- aguzhitou-network
|
||
|
|
|
||
|
|
volumes:
|
||
|
|
mysql_data:
|
||
|
|
redis_data:
|
||
|
|
|
||
|
|
networks:
|
||
|
|
aguzhitou-network:
|
||
|
|
driver: bridge
|