Enhance Dockerfile and README: Configure Maven to use Alibaba Cloud mirror for faster dependency downloads and update troubleshooting instructions for Maven dependency issues.

This commit is contained in:
liu
2026-01-30 01:04:39 +08:00
parent 246515b43e
commit 20a70270c7
2 changed files with 58 additions and 2 deletions

View File

@@ -73,3 +73,38 @@ docker compose up -d --build
4. 内置健康检查(每 30 秒检查 `/api/health` 端点)
- 生产环境前端 API/WebSocket 使用相对路径,与后端同源,无需再配 CORS。
- 已配置 `.dockerignore` 优化构建上下文,加快构建速度。
- **Maven 镜像**:已配置使用阿里云 Maven 镜像加速依赖下载,解决网络问题。
## 故障排查
### Maven 依赖下载失败
如果构建时遇到 Maven 依赖下载失败(如 `handshake_failure` 或网络超时):
1. **检查网络连接**:确保 Docker 容器可以访问外网
2. **使用国内镜像**:已默认配置阿里云镜像,如仍有问题可修改 `docker/maven-settings.xml`
3. **清理缓存重建**
```bash
docker compose down
docker compose build --no-cache
docker compose up -d
```
### 端口被占用
如果 8080 端口已被占用,修改 `docker-compose.yml` 中的端口映射:
```yaml
ports:
- "8888:8080" # 改为其他端口
```
### 查看详细日志
```bash
# 查看构建日志
docker compose build --progress=plain
# 查看运行日志
docker compose logs -f mangtool
```