简介
shardingsphere-elasticjob-ui安装部署要自己构建打包,还要假设http服务器,有点麻烦,官方竟然没有Docker镜像,只能自己动手构建了。现把自己构建过程记录下来,分享给有需要的人。
具体见:
https://gitee.com/johnnyzhou/shardingsphere-elasticjob-lite-ui-docker
3.0.1的Docker我也构建好了,可以直接使用:
https://hub.docker.com/repository/docker/johnny2002/shardingsphere-elasticjob-lite-ui
步骤
如果你想自己下载官方源码重新构建,详细过程如下:
- 下载最新版的源码,注意选择稳定版本,如tag 3.0.1-release
- 修改*pom.xml的spring-boot-maven-plugin:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
- 修改shardingsphere-elasticjob-lite-ui-backend (cloud也一样)目录下的pom.xml, 添加docker plugin
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.2.0</version>
<configuration>
<imageName>johnny2002/shardingsphere-elasticjob-lite-ui</imageName>
<baseImage>openjdk:8-jre-slim</baseImage>
<entryPoint>["sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom \
-Duser.timezone=Asia/Shanghai -Dauth.root_username=$AUTH_ROOT_NAME -Dauth.root_password=$AUTH_ROOT_PASSWD \
-Dauth.guest_username=$AUTH_GUEST_NAME -Dauth.guest_password=$AUTH_GUEST_PASSWD \
-Dspring.datasource.default.driver-class-name=$DS_DRIVER -Dspring.datasource.default.url=$DS_URL \
-Dspring.datasource.default.username=$DS_USER -Dspring.datasource.default.password=$DS_PASSWD \
-jar /usr/app/${project.build.finalName}.jar"]
</entryPoint>
<workdir>/usr/app</workdir>
<imageTags>
<imageTag>${project.version}</imageTag>
<imageTag>latest</imageTag>
</imageTags>
<exposes>8088</exposes>
<env>
<JAVA_OPTS>-Xms512m -Xmx512m -Xss1024K -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m</JAVA_OPTS>
<AUTH_ROOT_NAME>root</AUTH_ROOT_NAME>
<AUTH_ROOT_PASSWD>123456</AUTH_ROOT_PASSWD>
<AUTH_GUEST_NAME>guest</AUTH_GUEST_NAME>
<AUTH_GUEST_PASSWD>guest123</AUTH_GUEST_PASSWD>
<DS_DRIVER>org.h2.Driver</DS_DRIVER>
<DS_URL>jdbc:h2:mem:</DS_URL>
<DS_USER>sa</DS_USER>
<DS_PASSWD></DS_PASSWD>
</env>
<!-- copy the service's jar file from target into the root directory of the image -->
<resources>
<resource>
<targetPath>/usr/app</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
<dependencies>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
</plugin>
- *目录mvn clean install 构建
- shardingsphere-elasticjob-lite-ui-backend目录下执行mvn docker:build