Skip to content

Commit c2986e2

Browse files
authored
[app-builder] task: quick develop app-builder (#436)
1 parent a1199ed commit c2986e2

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,24 @@ bash docker/deploy.sh
4747
4848
> 如需修改数据库密码,二次启动前需要删除`docker/app-platform-tmp`目录
4949
50+
## 本地快速开发测试
51+
本章节给出快速启动之后,本地快速开发测试的方法。
52+
53+
### 1. 编译代码
54+
编写代码,在项目根目录下,执行以下命令编译:
55+
```shell
56+
mvn clean install
57+
```
58+
59+
### 2. 一键部署修改
60+
在项目根目录下,执行以下命令快速部署:
61+
```shell
62+
bash docker/dev-app-builder.sh
63+
```
64+
65+
### 3. 测试
66+
浏览器打开 http://localhost:8001 测试
67+
5068
## 源码编译启动
5169

5270
### 安装数据库

docker/dev-app-builder.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
set -eu
3+
4+
export WORKSPACE=$(cd "$(dirname "$(readlink -f "$0")")" && pwd)
5+
PLUGINS_DIR="${WORKSPACE}/../build/plugins"
6+
SHARED_DIR="${WORKSPACE}/../build/shared"
7+
8+
cd ${WORKSPACE}
9+
source .env
10+
11+
# 临时启动容器
12+
docker run -d --name app-builder-tmp --entrypoint sleep modelengine/app-builder:$VERSION infinity
13+
14+
# 拷贝本地编译产物到容器
15+
if [ -d "$PLUGINS_DIR" ] && [ -n "$(ls -A "$PLUGINS_DIR")" ]; then
16+
ls | grep -E '\.jar$' | grep -v -E '^(fit|fel)' | xargs rm -f
17+
docker cp "$PLUGINS_DIR"/. app-builder-tmp:/opt/fit-framework/plugins/
18+
else
19+
echo "Error: plugins directory is empty or doesn't exist, skipped copy."
20+
fi
21+
22+
if [ -d "$SHARED_DIR" ] && [ -n "$(ls -A "$SHARED_DIR")" ]; then
23+
ls | grep -E '\.jar$' | grep -v '^(opentelemetry)' | xargs rm -f
24+
docker cp "$SHARED_DIR"/. app-builder-tmp:/opt/fit-framework/shared/
25+
else
26+
echo "Error: shared directory is empty or doesn't exist, skipped copy."
27+
fi
28+
29+
# 提交镜像
30+
docker commit --change='ENTRYPOINT ["/opt/fit-framework/bin/start.sh"]' app-builder-tmp modelengine/app-builder:$VERSION
31+
docker commit --change='ENTRYPOINT ["/opt/fit-framework/bin/start.sh"]' app-builder-tmp app-builder:$VERSION
32+
33+
docker stop app-builder-tmp
34+
docker rm app-builder-tmp
35+
36+
# 重启服务
37+
docker-compose down
38+
echo "Service stopped."
39+
40+
docker-compose up -d
41+
echo "Service restarted."

0 commit comments

Comments
 (0)