53 lines
987 B
YAML
53 lines
987 B
YAML
version: '3.8'
|
|
|
|
services:
|
|
openai-proxy:
|
|
build: .
|
|
container_name: openai-proxy-go
|
|
ports:
|
|
- "3000:3000"
|
|
volumes:
|
|
# 挂载密钥文件(只读)
|
|
- ./keys.txt:/app/keys.txt:ro
|
|
# 挂载配置文件(只读)
|
|
- ./.env:/app/.env:ro
|
|
restart: unless-stopped
|
|
|
|
# 健康检查
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
# 环境变量
|
|
environment:
|
|
- GO_ENV=production
|
|
|
|
# 日志配置
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
|
|
# 资源限制
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 512M
|
|
cpus: '1.0'
|
|
reservations:
|
|
memory: 128M
|
|
cpus: '0.25'
|
|
|
|
# 网络配置
|
|
networks:
|
|
- proxy-network
|
|
|
|
# 网络定义
|
|
networks:
|
|
proxy-network:
|
|
driver: bridge
|