feat: add Docker deployment support
Add Dockerfile, docker-compose.yml, .dockerignore, .env.example, Makefile docker targets, and README/CHANGELOG docs.
This commit is contained in:
@@ -49,6 +49,33 @@ make vet # 静态检查 (go vet ./...)
|
||||
make clean # 删除二进制文件
|
||||
```
|
||||
|
||||
## Docker 部署
|
||||
|
||||
项目提供了 `Dockerfile` 与 `docker-compose.yml`,将编译产物打包为单一镜像(前端资源已通过 `go:embed` 内嵌,SQLite 为纯 Go 实现,镜像无外部依赖)。
|
||||
|
||||
### 使用 Docker Compose(推荐)
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
# 编辑 .env,设置 YDROPBOX_TOKEN 为一个高强度随机字符串
|
||||
docker compose up -d --build
|
||||
```
|
||||
|
||||
服务启动后监听 `8999` 端口,文件与数据库持久化在名为 `ydropbox-data` 的卷中。
|
||||
|
||||
### 仅使用 Docker
|
||||
|
||||
```bash
|
||||
docker build -t ydropbox .
|
||||
docker run -d --name ydropbox \
|
||||
-p 8999:8999 \
|
||||
-e YDROPBOX_TOKEN=YOUR_SECRET_TOKEN \
|
||||
-v "$(pwd)/workspace:/app/workspace" \
|
||||
ydropbox
|
||||
```
|
||||
|
||||
> 注意:必须通过 `-e YDROPBOX_TOKEN=...` 或 `--token` 提供访问令牌,否则服务启动会失败(与本地运行一致)。
|
||||
|
||||
## 配置
|
||||
|
||||
| 参数 / 环境变量 | 说明 | 默认值 |
|
||||
|
||||
Reference in New Issue
Block a user