fix:docker 打包器更换

pull/180/head
Layne Cai 4 years ago
parent bf9c7d2c75
commit aac1d8f19a

@ -304,11 +304,33 @@
<build>
<plugins>
<!-- Dockerfile 新插件 -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>${dockerfile.maven.plugin.version}</version>
<executions>
<execution>
<id>default</id>
<goals>
<!--如果package时不想用docker打包,就注释掉这个goal-->
<!-- <goal>build</goal>-->
<goal>push</goal>
</goals>
</execution>
</executions>
<configuration>
<username>sino-tech-admin</username>
<password>Fros_1234</password>
<repository>175.178.38.240:8076//${artifactId}</repository>
<tag>${project.version}</tag>
<buildArgs>
<!--提供参数向Dockerfile传递-->
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>

@ -57,58 +57,73 @@
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<!-- <plugin>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <goals>-->
<!-- <goal>repackage</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<configuration>
<dockerfile>
<!-- <username>sino-tech-admin</username>-->
<!-- <password>Fros_1234</password>-->
<!--指定包名-->
<repository>${project.artifactId}</repository>
<tag>${project.version}</tag>
<buildArgs>
<!--注意imageName一定要是符合正则[a-z0-9-_.]的,否则构建不会成功-->
<imageName>${project.artifactId}:last</imageName>
<!--指定基础镜像-->
<baseImage>openjdk:8-jre</baseImage>
<!--指定远程docker地址-->
<!--使用http协议 https 需要加TLS证书-->
<dockerHost>http://175.178.38.240:8076</dockerHost>
<!-- &lt;!&ndash;配置TLS证书在系统中的路径&ndash;&gt;-->
<!-- <dockerCertPath>/Users/root/docker-ca</dockerCertPath>-->
<!-- 指定默认挂载地址 -->
<volumes>/mydata/service/ruoyi</volumes>
<!-- 创建目录-->
<runs>mkdir -p /mydata/service/ruoyi</runs>
<workdir>/mydata/service/ruoyi</workdir>
<entryPoint>
["java", "-jar", "-Dspring.profiles.active=dev","/mydata/service/ruoyi/${project.build.finalName}.jar"]
</entryPoint>
<!-- <buildArgs>-->
<!-- <JAR-FILE>target/${project.build.finalName}.jar</JAR-FILE>-->
<!-- </buildArgs>-->
<!--复制jar包到docker容器指定目录-->
<!-- <resources>-->
<!-- <resource>-->
<!-- <targetPath>/mydata/service/ruoyi</targetPath>-->
<!-- &lt;!&ndash;jar包在项目中生成的路径即对应的target目录&ndash;&gt;-->
<!-- <directory>${project.build.directory}</directory>-->
<!-- &lt;!&ndash;指定需要复制的文件&ndash;&gt;-->
<!-- <include>${project.build.finalName}.jar</include>-->
<!-- </resource>-->
<!-- </resources>-->
<!--提供参数向Dockerfile传递-->
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</dockerfile>
</configuration>
<!-- <configuration>-->
<!-- <dockerfile>-->
<!-- <buildArgs>-->
<!-- &lt;!&ndash;注意imageName一定要是符合正则[a-z0-9-_.]的,否则构建不会成功&ndash;&gt;-->
<!-- <imageName>${project.artifactId}:last</imageName>-->
<!-- &lt;!&ndash;指定基础镜像&ndash;&gt;-->
<!-- <baseImage>openjdk:8-jre</baseImage>-->
<!-- &lt;!&ndash;指定远程docker地址&ndash;&gt;-->
<!-- &lt;!&ndash;使用http协议 https 需要加TLS证书&ndash;&gt;-->
<!-- <dockerHost>http://175.178.38.240:8076</dockerHost>-->
<!-- &lt;!&ndash; &lt;!&ndash;配置TLS证书在系统中的路径&ndash;&gt;&ndash;&gt;-->
<!-- &lt;!&ndash; <dockerCertPath>/Users/root/docker-ca</dockerCertPath>&ndash;&gt;-->
<!-- &lt;!&ndash; 指定默认挂载地址 &ndash;&gt;-->
<!-- <volumes>/mydata/service/ruoyi</volumes>-->
<!-- &lt;!&ndash; 创建目录&ndash;&gt;-->
<!-- <runs>mkdir -p /mydata/service/ruoyi</runs>-->
<!-- <workdir>/mydata/service/ruoyi</workdir>-->
<!-- <entryPoint>-->
<!-- ["java", "-jar", "-Dspring.profiles.active=dev","/mydata/service/ruoyi/${project.build.finalName}.jar"]-->
<!-- </entryPoint>-->
<!-- &lt;!&ndash; <buildArgs>&ndash;&gt;-->
<!-- &lt;!&ndash; <JAR-FILE>target/${project.build.finalName}.jar</JAR-FILE>&ndash;&gt;-->
<!-- &lt;!&ndash; </buildArgs>&ndash;&gt;-->
<!-- &lt;!&ndash;复制jar包到docker容器指定目录&ndash;&gt;-->
<!-- &lt;!&ndash; <resources>&ndash;&gt;-->
<!-- &lt;!&ndash; <resource>&ndash;&gt;-->
<!-- &lt;!&ndash; <targetPath>/mydata/service/ruoyi</targetPath>&ndash;&gt;-->
<!-- &lt;!&ndash; &lt;!&ndash;jar包在项目中生成的路径即对应的target目录&ndash;&gt;&ndash;&gt;-->
<!-- &lt;!&ndash; <directory>${project.build.directory}</directory>&ndash;&gt;-->
<!-- &lt;!&ndash; &lt;!&ndash;指定需要复制的文件&ndash;&gt;&ndash;&gt;-->
<!-- &lt;!&ndash; <include>${project.build.finalName}.jar</include>&ndash;&gt;-->
<!-- &lt;!&ndash; </resource>&ndash;&gt;-->
<!-- &lt;!&ndash; </resources>&ndash;&gt;-->
<!-- </buildArgs>-->
<!-- </dockerfile>-->
<!-- </configuration>-->
</plugin>
</plugins>
</build>

Loading…
Cancel
Save