gitdataai/docker/README.md
2026-06-01 22:04:17 +08:00

70 lines
1.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# GitDataAI Docker
默认镜像仓库:`harbor.gitdata.me/app`
## 服务
| Dockerfile | 服务 | 端口 | 健康检查 |
|-----------|------|------|---------|
| `gitdata.Dockerfile` | API 服务 | 8080 | `/metrics` |
| `gitpod.Dockerfile` | Git 协议 (HTTP/SSH/gRPC) | 8080, 2222, 50051 | `/health` |
| `gitsync.Dockerfile` | Git 同步 worker | 8081 | `/health` |
| `email.Dockerfile` | 邮件 worker | 8083 | `/health` |
| `web.Dockerfile` | 前端 | 80 | `/` |
## 构建
先编译 Rust 二进制,再打镜像:
```bash
# 编译全部 Rust 服务
cargo build --release
# 构建全部镜像 (默认推送到 harbor.gitdata.me/app)
./docker/build.sh
# 只构建指定服务
./docker/build.sh gitdata gitpod
# 自定义 tag
./docker/build.sh -t v1.2.0
# 自定义 registry
./docker/build.sh -r myreg.io/app -t dev
```
## 推送
```bash
# 推送全部 (默认 harbor.gitdata.me/app)
./docker/push.sh
# 推送指定服务
./docker/push.sh gitdata gitpod
# 自定义 tag / registry
./docker/push.sh -t v1.2.0
./docker/push.sh -r myreg.io/app -t dev
```
## 本地开发
使用 docker compose 启动全部服务(含依赖的 Postgres/Redis/Qdrant/NATS/MinIO
```bash
docker compose -f docker/docker-compose.yml up -d
```
compose 默认从 `harbor.gitdata.me/app` 拉取镜像,可通过环境变量覆盖:
```bash
IMAGE_REGISTRY=myreg.io/app IMAGE_TAG=v1.2.0 \
docker compose -f docker/docker-compose.yml up -d
```
## 镜像结构
- Rust 服务:`debian:bookworm-slim` + 预编译二进制(~20MB
- 前端:多阶段构建 `oven/bun` + `nginx:alpine`
- 数据库迁移在 gitdata 启动时自动执行(见 lib/migrate