Files
wecom-ai-assistant/QUICK_BUILD.md
bujie9527 3c95ae0000
Some checks failed
Build and Deploy / test-backend (push) Has been cancelled
Build and Deploy / build-backend (push) Has been cancelled
Build and Deploy / build-admin (push) Has been cancelled
Deploy to Production / build-backend (push) Has been cancelled
Deploy to Production / deploy (push) Has been cancelled
Add Docker mirror configuration and build scripts
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-05 22:42:05 +08:00

113 lines
2.9 KiB
Markdown
Raw 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.
# 快速构建并推送到 registry.667788.cool
## 问题:无法连接 Docker Hub
如果遇到 `failed to fetch oauth token` 错误,需要配置 Docker 镜像加速。
## 解决方案
### 方案一:配置 Docker Desktop 镜像加速(推荐)
1. **打开 Docker Desktop**
2. **Settings****Docker Engine**
3. **添加镜像加速配置**
```json
{
"registry-mirrors": [
"https://docker.mirrors.ustc.edu.cn",
"https://hub-mirror.c.163.com",
"https://mirror.baidubce.com"
]
}
```
4. **点击 Apply & Restart**
5. **等待 Docker 重启完成**
### 方案二:使用构建参数指定镜像源
如果无法配置 Docker Desktop可以使用构建参数
#### 构建 Backend 镜像
```powershell
# 使用 USTC 镜像源
docker build --build-arg PYTHON_IMAGE=docker.mirrors.ustc.edu.cn/library/python:3.12-slim -f deploy/docker/backend.Dockerfile -t registry.667788.cool/wecom-ai/wecom-ai-backend:latest .
# 推送
docker push registry.667788.cool/wecom-ai/wecom-ai-backend:latest
```
#### 构建 Admin 镜像
```powershell
# 使用 USTC 镜像源
docker build --build-arg NODE_IMAGE=docker.mirrors.ustc.edu.cn/library/node:20-alpine -f deploy/docker/admin.Dockerfile -t registry.667788.cool/wecom-ai/wecom-ai-admin:latest .
# 推送
docker push registry.667788.cool/wecom-ai/wecom-ai-admin:latest
```
## 完整构建流程
### 1. 配置镜像加速(方案一)
按照上面的方案一配置 Docker Desktop。
### 2. 构建并推送镜像
```powershell
# Backend
docker build -f deploy/docker/backend.Dockerfile -t registry.667788.cool/wecom-ai/wecom-ai-backend:latest .
docker push registry.667788.cool/wecom-ai/wecom-ai-backend:latest
# Admin
docker build -f deploy/docker/admin.Dockerfile -t registry.667788.cool/wecom-ai/wecom-ai-admin:latest .
docker push registry.667788.cool/wecom-ai/wecom-ai-admin:latest
```
### 3. 验证
```powershell
# 查看本地镜像
docker images | grep registry.667788.cool
# 应该看到:
# registry.667788.cool/wecom-ai/wecom-ai-backend latest ...
# registry.667788.cool/wecom-ai/wecom-ai-admin latest ...
```
## 如果 Registry 需要认证
```powershell
# 登录 Registry
docker login registry.667788.cool
# 输入用户名和密码
```
## 故障排查
### 问题:仍然无法拉取基础镜像
**解决方案**
1. 尝试其他镜像源:
- `hub-mirror.c.163.com/library/python:3.12-slim`
- `mirror.baidubce.com/library/python:3.12-slim`
2. 使用代理
3. 手动拉取基础镜像:
```powershell
docker pull docker.mirrors.ustc.edu.cn/library/python:3.12-slim
docker tag docker.mirrors.ustc.edu.cn/library/python:3.12-slim python:3.12-slim
```
### 问题:推送失败
**检查项**
1. Registry 是否需要登录
2. 网络连接是否正常
3. 镜像名称格式是否正确
## 参考文档
- [Docker 镜像加速配置](./docs/docker-mirror.md)
- [Registry 配置指南](./REGISTRY_667788_SETUP.md)