替换docker插件,可直接通过maven插件部署和运行

This commit is contained in:
thinkgem
2020-06-03 23:23:16 +08:00
parent 61a0dd8eed
commit e15fee860e
8 changed files with 50 additions and 51 deletions

View File

@@ -15,5 +15,4 @@ cd ..
call mvn clean deploy -Dmaven.test.skip=true -Pdeploy
cd bin
cmd /c msg %username% /time:0 /w "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>..."
pause

View File

@@ -15,5 +15,4 @@ cd ..
call mvn clean install -Dmaven.test.skip=true -Ppackage
cd bin
cmd /c msg %username% /time:0 /w "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>..."
pause

View File

@@ -66,6 +66,10 @@
<eclipse-plugin-download-sources>false</eclipse-plugin-download-sources>
<eclipse-plugin-download-javadocs>false</eclipse-plugin-download-javadocs>
<!-- docker setting -->
<docker.dockerHost>http://192.168.56.102:2375</docker.dockerHost>
<docker.imageName>${project.groupId}/${project.artifactId}:4.2</docker.imageName>
</properties>
<dependencies>
@@ -224,7 +228,7 @@
<goal>jar</goal>
</goals>
<configuration>
<doclint>none</doclint>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</execution>
</executions>
@@ -284,6 +288,35 @@
</lifecycleMappingMetadata>
</configuration>
</plugin> -->
<!-- Docker 插件 -->
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.33.0</version>
<configuration>
<dockerHost>${docker.dockerHost}</dockerHost>
<verbose>true</verbose>
<images>
<image>
<name>${docker.imageName}</name>
<alias>${project.artifactId}</alias>
<build>
<dockerFile>${project.basedir}/bin/docker/Dockerfile</dockerFile>
<assembly>
<descriptorRef>artifact</descriptorRef>
</assembly>
</build>
<run>
<ports>
<port>${docker.run.port}</port>
</ports>
</run>
</image>
</images>
</configuration>
</plugin>
</plugins>
</pluginManagement>

View File

@@ -12,8 +12,7 @@ echo.
cd %~dp0
cd ..
call mvn clean package docker:build -Dmaven.test.skip=true -U -Pdocker
call mvn clean package docker:stop docker:remove docker:build docker:run -Dmaven.test.skip=true -U
cd bin
cmd /c msg %username% /time:0 /w "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>..."
pause

View File

@@ -10,6 +10,6 @@ echo "[信息] 使用 Spring Boot Docker 编译 Web 工程。"
echo ""
cd ..
mvn clean package docker:build -Dmaven.test.skip=true -U -Pdocker
mvn clean package docker:stop docker:remove docker:build docker:run -Dmaven.test.skip=true -U
cd bin

View File

@@ -3,21 +3,23 @@ MAINTAINER ThinkGem@163.com
ENV TZ "Asia/Shanghai"
ENV LANG C.UTF-8
VOLUME /tmp
VOLUME /data
WORKDIR /app
ADD web.war .
RUN jar -xvf web.war
# RUN chmod -R 755 ./*
ADD ./maven/web.war ./app.war
RUN jar -xvf app.war
#RUN chmod -R 755 ./*
WORKDIR /app/WEB-INF
ENV JAVA_OPTS "-Xms256m -Xmx1024m"
ADD ./app.yml ./classes/config/application-prod.yml
#ADD jeesite.lic ./
#ENV JAVA_OPTS "-Xms256m -Xmx1024m"
ENV JAVA_OPTS "$JAVA_OPTS -Dspring.profiles.active=prod"
ADD application-prod.yml ./classes/config
# ADD jeesite.lic .
ENTRYPOINT java -cp /app $JAVA_OPTS org.springframework.boot.loader.WarLauncher
ENTRYPOINT java $JAVA_OPTS -cp /app $JAVA_OPTS org.springframework.boot.loader.WarLauncher
EXPOSE 8980
# docker run -p 8980:8980 com.jeesite/jeesite-web:4.2
#docker run -p 8980:8980 com.jeesite/jeesite-web:4.2

View File

@@ -22,5 +22,5 @@ mybatis:
file:
# 文件上传根路径设置路径中不允许包含“userfiles”在指定目录中系统会自动创建userfiles目录如果不设置默认为contextPath路径
baseDir: /root/jeesite
baseDir: /data

View File

@@ -26,9 +26,8 @@
<eclipse-plugin-download-sources>false</eclipse-plugin-download-sources>
<eclipse-plugin-download-javadocs>false</eclipse-plugin-download-javadocs>
<!-- docker service -->
<docker.registryUrl>http://192.168.56.102:2375</docker.registryUrl>
<docker.imageName>${project.groupId}/${project.artifactId}:4.2</docker.imageName>
<!-- docker setting -->
<docker.run.port>8980:8980</docker.run.port>
</properties>
@@ -129,38 +128,6 @@
</plugins>
</build>
<profiles>
<!-- Docker 插件 -->
<profile>
<id>docker</id>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.1.0</version>
<configuration>
<serverId>docker-hub</serverId>
<registryUrl>${docker.registryUrl}</registryUrl>
<dockerHost>${docker.registryUrl}</dockerHost>
<imageName>${docker.imageName}</imageName>
<dockerDirectory>${project.basedir}/bin/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>web.war</include>
</resource>
</resources>
<forceTags>true</forceTags>
<pushImage>false</pushImage>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<developers>
<developer>
<id>thinkgem</id>