-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
91 lines (87 loc) · 2.39 KB
/
docker-compose.yml
File metadata and controls
91 lines (87 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# NewAPI Middleware Tool - Docker Compose Configuration
#
# 使用方式:
# 1. 通过 install.sh 一键安装 (推荐)
# 2. 通过 deploy.sh 自动部署: ./deploy.sh
# 3. 手动部署: 复制 .env.example 为 .env 并配置后运行 docker-compose up -d
#
# 更新方式:
# docker compose pull && docker compose down && docker compose up -d
services:
newapi-tools:
image: ghcr.io/james-6-23/new_api_tools:latest
container_name: newapi-tools
ports:
- "${FRONTEND_PORT:-1145}:80"
environment:
# 数据库配置 (Go 版本统一使用 SQL_DSN)
- SQL_DSN=${SQL_DSN:-}
# 兼容旧版本分离配置
- DB_ENGINE=${DB_ENGINE:-}
- DB_DNS=${DB_DNS:-}
- DB_PORT=${DB_PORT:-}
- DB_NAME=${DB_NAME:-}
- DB_USER=${DB_USER:-}
- DB_PASSWORD=${DB_PASSWORD:-}
# 认证
- API_KEY=${API_KEY}
- ADMIN_PASSWORD=${ADMIN_PASSWORD}
- JWT_SECRET_KEY=${JWT_SECRET}
- JWT_EXPIRE_HOURS=${JWT_EXPIRE_HOURS:-24}
# Redis 缓存
- REDIS_CONN_STRING=redis://:${REDIS_PASSWORD:-}@redis:6379/0
# 服务配置
- SERVER_HOST=0.0.0.0
- SERVER_PORT=8000
- TIMEZONE=${TIMEZONE:-Asia/Shanghai}
- LOG_LEVEL=${LOG_LEVEL:-info}
# NewAPI 连接
- NEWAPI_BASEURL=${NEWAPI_BASEURL:-}
volumes:
- ./data:/app/data
restart: unless-stopped
depends_on:
redis:
condition: service_healthy
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "3"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/api/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
networks:
- default
- newapi-network
# Redis 缓存服务
redis:
image: redis:7-alpine
container_name: newapi-tools-redis
command: >
redis-server
--appendonly yes
--maxmemory 256mb
--maxmemory-policy allkeys-lru
${REDIS_PASSWORD:+--requirepass ${REDIS_PASSWORD}}
volumes:
- redis_data:/data
restart: unless-stopped
networks:
- default
healthcheck:
test: ["CMD-SHELL", "redis-cli ${REDIS_PASSWORD:+-a ${REDIS_PASSWORD}} ping | grep -q PONG"]
interval: 5s
timeout: 3s
retries: 3
start_period: 2s
networks:
default:
newapi-network:
external: true
name: ${NEWAPI_NETWORK:-new-api_default}
volumes:
redis_data: