Files
new-api-oiss/docker-compose.yml
huangzhenpc 585a9667be fix: use existing MySQL volume from old deployment
Reference the old new-api_mysql_data volume as external so all
existing data is preserved without re-import.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 00:44:25 +08:00

52 lines
1.1 KiB
YAML

version: '3.4'
services:
new-api:
build: .
container_name: new-api
restart: always
command: --log-dir /app/logs
ports:
- "3030:3000"
volumes:
- ./data:/data
- ./logs:/app/logs
environment:
- SQL_DSN=root:123456@tcp(mysql:3306)/new-api
- REDIS_CONN_STRING=redis://redis
- TZ=Asia/Shanghai
- ERROR_LOG_ENABLED=true
# - STREAMING_TIMEOUT=300
# - SESSION_SECRET=random_string
# - SYNC_FREQUENCY=60
depends_on:
- redis
- mysql
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://localhost:3000/api/status | grep -o '\"success\":\\s*true' | awk -F: '{print $$2}'"]
interval: 30s
timeout: 10s
retries: 3
redis:
image: redis:latest
container_name: redis
restart: always
mysql:
image: mysql:8.2
container_name: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: 123456
MYSQL_DATABASE: new-api
volumes:
- mysql_data:/var/lib/mysql
# ports:
# - "3306:3306"
volumes:
mysql_data:
external: true
name: new-api_mysql_data