优化Docker配置:支持通过环境变量自定义宿主机与容器端口映射

This commit is contained in:
2026-01-28 13:59:37 +08:00
parent 61de3f44dc
commit c8a7ea5490
2 changed files with 4 additions and 2 deletions

View File

@@ -101,3 +101,5 @@ BingPaper 支持通过配置文件YAML和环境变量进行配置。
- `BINGPAPER_STORAGE_TYPE=s3`
- `BINGPAPER_STORAGE_S3_BUCKET=my-images`
- `BINGPAPER_ADMIN_PASSWORD_BCRYPT="$2a$10$..."`
- `HOST_PORT=8080` (仅限 Docker Compose 部署,控制宿主机映射到外部的端口)
- `BINGPAPER_SERVER_PORT=8080` (控制应用监听端口及容器内部端口)

View File

@@ -8,12 +8,12 @@ services:
container_name: bingpaper
restart: always
ports:
- "8080:8080"
- "${HOST_PORT:-8080}:${BINGPAPER_SERVER_PORT:-8080}"
volumes:
- ./data:/app/data
environment:
- TZ=Asia/Shanghai
- BINGPAPER_SERVER_PORT=8080
- BINGPAPER_SERVER_PORT=${BINGPAPER_SERVER_PORT:-8080}
- BINGPAPER_LOG_LEVEL=info
- BINGPAPER_API_MODE=local
- BINGPAPER_CRON_ENABLED=true