feat: add multi-stage Dockerfile for full build with martial-tool

- Add Dockerfile.fullbuild: multi-stage build that compiles martial-tool
- Rename Dockerfile to Dockerfile.quick for quick builds (pre-built jar)
- Update docker-compose.yml to use parent directory context
- Update README with new deployment instructions
This commit is contained in:
2025-12-29 14:34:54 +08:00
parent 47d0b70a9c
commit 86e4580e5d
4 changed files with 81 additions and 18 deletions

View File

@@ -28,20 +28,29 @@
### 环境要求
- JDK 17+
- Maven 3.8+
- Docker & Docker Compose
### Docker Compose 部署(推荐)
### 一键部署(推荐)
确保目录结构如下:
```
martial/
├── martial-tool/ # BladeX 框架(必需)
├── martial-master/ # 后端项目
├── martial-web/ # 管理后台前端
├── martial-mini/ # 用户端小程序
└── martial-admin-mini/ # 裁判端小程序
```
```bash
# 克隆项目
git clone https://git.waypeak.work/martial/martial-master.git
cd martial-master
cd martial/martial-master
# 启动所有服务
# 首次部署完整构建约5-6分钟
docker compose up -d
# 查看构建日志
docker compose logs -f martial-api
# 查看服务状态
docker compose ps
```
@@ -50,14 +59,19 @@ docker compose ps
- API 服务: http://localhost:8123
- API 文档: http://localhost:8123/doc.html
### 本地开发
### 快速构建(开发迭代)
如果已经手动编译过 JAR可以使用快速构建
```bash
# 编译项目
mvn clean package -DskipTests
# 编译 martial-tool首次
cd ../martial-tool && mvn clean install -DskipTests
# 运行(需要先启动 MySQL 和 Redis
mvn spring-boot:run -Dspring-boot.run.profiles=dev
# 编译 martial-master
cd ../martial-master && mvn clean package -DskipTests
# 使用快速构建 Dockerfile
docker compose build martial-api --build-arg DOCKERFILE=Dockerfile.quick
```
## 项目结构
@@ -79,7 +93,8 @@ martial-master/
├── database/ # 数据库初始化脚本
├── docs/ # 项目文档
├── docker-compose.yml # Docker 编排配置
── Dockerfile # 镜像构建文件
── Dockerfile.fullbuild # 完整构建(含 martial-tool
└── Dockerfile.quick # 快速构建(需预编译 JAR
```
## Docker Compose 服务