提交 c1e7ae8f 编写于 作者: sq3536's avatar sq3536

docker

上级 202fd912
FROM maven:3.8.3-adoptopenjdk-8
ENV TZ=Asia/Shanghai \
JAVA_OPTS=""
WORKDIR /
ADD settings.xml /root/.m2/settings.xml
ADD pom.xml /pom.xml
RUN mvn package && mvn ibizlabcli:help && git config --global user.name "ibizlabcli" && git config --global user.email "ibizlabcli@ibizsys.net"
ADD ibizlabcli /usr/bin/ibizlabcli
CMD ["/usr/bin/ibizlabcli"]
#docker buildx build --platform linux/arm64,linux/amd64 -t ibiz4j/ibizlab-cli:1.0.1 -t ibiz4j/ibizlab-cli:latest --push .
\ No newline at end of file
version: "3.2"
services:
maven:
#image: maven:3.8.3-adoptopenjdk-8
image: ibiz4j/ibizlab-cli:latest
environment:
- CODEGEN_CODE_URL=http://demo.ibizlab.cn/t48e9d7d8e2dab3018133378ca1d8a4b6/xftong #源git库repo,同义参数GIT_PROD_REPO
- CODEGEN_CODE_PASSWORD=pppppp #源git库oauth2令牌,同义参数GIT_PROD_REPO
- CODEGEN_CODE_BRANCH=master #源git库分支,同义参数GIT_PROD_BRANCH,不设置默认取master
- CODEGEN_RO_URL=http://oauth2:xxxx@demo.ibizlab.cn/t48e9d7d8e2dab3018133378ca1d8a4b6/xftongdev #目标git库repo,同义参数GIT_DEV_REPO
- CODEGEN_RO_BRANCH=master #目标git库分支,同义参数GIT_DEV_BRANCH,不设置默认取master
- CODEGEN_CODE_USER=ibiz4j #git提交用户,同义参数GIT_DEV_USER_NAME
- CODEGEN_RO_USER=ibiz4j #git提交用户,同义参数GIT_DEV_USER_NAME
# - GIT_PROD_REPO=http://oauth2:xxxx@demo.ibizlab.cn/t48e9d7d8e2dab3018133378ca1d8a4b6/xftong
# - GIT_PROD_BRANCH=master
# - GIT_DEV_REPO=http://oauth2:xxxx@demo.ibizlab.cn/t48e9d7d8e2dab3018133378ca1d8a4b6/xftongdev
# - GIT_DEV_BRANCH=maste
# - GIT_DEV_USER_NAME=ibizlabcli
# - GIT_DEV_USER_EMAIL=ibizlabcli@ibizsys.net
# - GIT_PUSH_MESSAGE=cli
# - CLI_UPDATE=true
#!/bin/bash
if [ $CLI_UPDATE ];then
if [ "TRUE" == `echo $CLI_UPDATE` ];then
mvn package
fi
if [ "true" == `echo $CLI_UPDATE` ];then
mvn package
fi
if [ "True" == `echo $CLI_UPDATE` ];then
mvn package
fi
fi
if [ ! $GIT_PROD_REPO ];then
if [ ! $CODEGEN_CODE_URL ];then
echo "unknow prod git, env GIT_PROD_REPO or CODEGEN_CODE_URL does not exist."
exit 1
fi
if [ $CODEGEN_CODE_PASSWORD ];then
if [[ ! "${CODEGEN_CODE_URL}" =~ "@" ]];then
CODEGEN_CODE_URL=${CODEGEN_CODE_URL/#"http://"/"http://oauth2:${CODEGEN_CODE_PASSWORD}@"}
else
CODEGEN_CODE_URL=${CODEGEN_CODE_URL#*@}
CODEGEN_CODE_URL="http://oauth2:${CODEGEN_CODE_PASSWORD}@"$CODEGEN_CODE_URL
fi
fi
GIT_PROD_REPO=$CODEGEN_CODE_URL
fi
if [ ! $GIT_PROD_BRANCH ];then
if [ ! $CODEGEN_CODE_BRANCH ];then
GIT_PROD_BRANCH=master
echo "env GIT_PROD_BRANCH or CODEGEN_CODE_BRANCH does not exist, using 'master'."
else
GIT_PROD_BRANCH=$CODEGEN_CODE_BRANCH
fi
fi
if [ ! $GIT_DEV_REPO ];then
if [ ! $CODEGEN_RO_URL ];then
echo "unknow dev git, env GIT_DEV_REPO or CODEGEN_RO_URL does not exist."
exit 1
fi
GIT_DEV_REPO=$CODEGEN_RO_URL
fi
if [ ! $GIT_DEV_BRANCH ];then
if [ ! $CODEGEN_RO_BRANCH ];then
GIT_DEV_BRANCH=master
echo "env GIT_DEV_BRANCH or CODEGEN_RO_BRANCH does not exist, using 'master'."
else
GIT_DEV_BRANCH=$CODEGEN_RO_BRANCH
fi
fi
mkdir -p /generator
cd /generator
rm -rf /generator/*
git clone -b $GIT_PROD_BRANCH --depth=1 $GIT_PROD_REPO prod
if [ ! $MODELFOLDER ];then
if [ ! $CODEGEN_MODEL_PATH ];then
if [ -f "prod/ibizmodel.yaml" ];then
MODELFOLDER=`sed '/^modelfolder: /!d;s/.*: //' prod/ibizmodel.yaml`
fi
else
MODELFOLDER=$CODEGEN_MODEL_PATH
fi
fi
if [ ! $MODELFOLDER ];then
echo "unknow model folder, env MODELFOLDER or CODEGEN_MODEL_PATH does not exist, ibizmodel.yaml not found."
exit 1
fi
echo spec dir: $MODELFOLDER
git clone -b $GIT_DEV_BRANCH $GIT_DEV_REPO dev
cd prod
java ${JAVA_OPTS} -Duser.timezone=$TZ -jar /root/.m2/repository/cn/ibizlab/ibizlab-generator-cli/1.0-SNAPSHOT/ibizlab-generator-cli-1.0-SNAPSHOT.jar generate -i $MODELFOLDER -c ../dev/generator.yml -o ../dev
rm -rf dev/generator.xml
cd ../dev/
if [ ! $GIT_DEV_USER_NAME ];then
if [ $CODEGEN_RO_USER ];then
GIT_DEV_USER_NAME=$CODEGEN_RO_USER
else
if [ $CODEGEN_CODE_USER ];then
GIT_DEV_USER_NAME=$CODEGEN_CODE_USER
else
GIT_DEV_USER_NAME=ibizlabcli
echo "env GIT_DEV_USER_NAME or CODEGEN_RO_USER or CODEGEN_CODE_USER does not exist, using 'ibizlabcli'."
fi
fi
fi
git config user.name "$GIT_DEV_USER_NAME"
if [ ! $GIT_DEV_USER_EMAIL ];then
GIT_DEV_USER_EMAIL=$GIT_DEV_USER_NAME@ibizsys.net
fi
git config user.email "$GIT_DEV_USER_EMAIL"
set +e
git add .
git commit -m "generate by $GIT_DEV_USER_NAME. $GIT_PUSH_MESSAGE"
git push origin $GIT_DEV_BRANCH
set -e
exit 0
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.ibizlab</groupId>
<artifactId>ibizlab-generator-docker</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>cn.ibizlab</groupId>
<artifactId>ibizlab-generator-cli</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.ibizlab</groupId>
<artifactId>ibizlab-generator-core</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.ibizlab</groupId>
<artifactId>ibizlab-generator-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.ibizlab</groupId>
<artifactId>ibizlab-template-ibizboot</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.ibizlab</groupId>
<artifactId>ibizlab-template-ibizedge</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>ibizmvnrepository-plugin</id>
<url>http://172.16.240.220:8081/repository/releases</url>
</repository>
<snapshotRepository>
<id>ibizmvnrepository-plugin</id>
<url>http://172.16.240.220:8081/repository/snapshots</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>aliyunmaven</id>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
<repository>
<id>ibizmvnrepository</id>
<name>ibizmvnrepository</name>
<url>http://172.16.240.220:8081/repository/public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>ibizmvnrepository-plugin</id>
<url>http://172.16.240.220:8081/repository/public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>aliyun-plugin</id>
<url>https://maven.aliyun.com/repository/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<configuration>
<generateBackupPoms>false</generateBackupPoms>
</configuration>
</plugin>
<plugin>
<groupId>cn.ibizlab</groupId>
<artifactId>ibizlab-generator-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
<output>
/target
</output>
<inputSpec>
/target
</inputSpec>
<packageName>
${project.groupId}
</packageName>
<name>
${project.artifactId}
</name>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
#目标开发库git根目录中必须存在此 generator.yml 文件,用来指定选用模板等参数
#配置文件支持环境变量设置,参照${系统环境变量键值:默认值}格式
generator:
#模板和版本,支持多个模板组合
#目前后台模板有全代码版ibizlab-template-ibizedge和扩展cloud版ibizlab-template-ibizboot两种可选
embedTemplates:
- ${templateName:ibizlab-template-ibizedge}:${templateVersion:1.0-SNAPSHOT}
#文件夹订阅复制,源代码库路径文件夹或文件相对路径:开发代码库路径文件夹或文件相对路径
volumes:
- ${modelFolder}:${modelFolder} #模型文件夹复制,可以直接用modelFolder环境变量,通常模型文件夹是必须的
- app_web:app_web #本项目前端vue文件复制,注意路径,不拷贝请删除该行
- xxxxxx-core/src/main/resources/application-sys.yml:xxxxxx-core/src/main/resources/application-sys.yml #本项目配置文件复制,自行选择,注意路径,不拷贝请删除该行
- xxxxxx-core/src/main/resources/application-nacos.yml:xxxxxx-core/src/main/resources/application-nacos.yml #本项目配置文件复制,自行选择,注意路径,不拷贝请删除该行
- xxxxxx-boot/pom.xml:xxxxxx-boot/pom.xml #本项目配置文件复制,自行选择,注意路径,不拷贝请删除该行
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册