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:
@@ -6,6 +6,19 @@ All notable changes to this template should be documented in this file.
|
||||
The format loosely follows Keep a Changelog and can be adapted to the team's habits.
|
||||
本文档参考了 Keep a Changelog 的思路,也可以根据团队习惯调整。
|
||||
|
||||
## [0.1.0] - 2026-08-27
|
||||
|
||||
### Added / 新增
|
||||
|
||||
- Added Docker deployment support: `Dockerfile`, `.dockerignore`, `docker-compose.yml` and `.env.example`.
|
||||
- 新增 Docker 部署支持:`Dockerfile`、`.dockerignore`、`docker-compose.yml` 与 `.env.example`。
|
||||
|
||||
- Added `make docker` / `make docker-up` / `make docker-down` convenience targets to the Makefile.
|
||||
- 在 Makefile 中新增 `make docker` / `make docker-up` / `make docker-down` 便捷命令。
|
||||
|
||||
- Documented Docker deployment in `docs/README.md`.
|
||||
- 在 `docs/README.md` 中补充了 Docker 部署说明。
|
||||
|
||||
## [0.0.1] - 2026-04-28
|
||||
|
||||
### Added / 新增
|
||||
|
||||
@@ -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