fix:docker 打包器更换

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

@ -304,12 +304,34 @@
<build> <build>
<plugins> <plugins>
<!-- Dockerfile 新插件 -->
<plugin> <plugin>
<groupId>com.spotify</groupId> <groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId> <artifactId>dockerfile-maven-plugin</artifactId>
<version>${dockerfile.maven.plugin.version}</version> <version>${dockerfile.maven.plugin.version}</version>
</plugin> <executions>
<plugin> <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> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>${compiler.maven.plugin.version}</version> <version>${compiler.maven.plugin.version}</version>

@ -1,116 +1,131 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId> <artifactId>ruoyi</artifactId>
<version>3.4.0</version> <version>3.4.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>ruoyi-auth</artifactId> <artifactId>ruoyi-auth</artifactId>
<description> <description>
ruoyi-auth认证授权中心 ruoyi-auth认证授权中心
</description> </description>
<dependencies> <dependencies>
<!-- SpringCloud Alibaba Nacos --> <!-- SpringCloud Alibaba Nacos -->
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency> </dependency>
<!-- SpringCloud Alibaba Nacos Config --> <!-- SpringCloud Alibaba Nacos Config -->
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency> </dependency>
<!-- SpringCloud Alibaba Sentinel --> <!-- SpringCloud Alibaba Sentinel -->
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency> </dependency>
<!-- SpringBoot Web --> <!-- SpringBoot Web -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependency>
<!-- SpringBoot Actuator --> <!-- SpringBoot Actuator -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId> <artifactId>spring-boot-starter-actuator</artifactId>
</dependency> </dependency>
<!-- RuoYi Common Security--> <!-- RuoYi Common Security-->
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-security</artifactId> <artifactId>ruoyi-common-security</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>
<plugins> <plugins>
<!-- <plugin>--> <plugin>
<!-- <groupId>org.springframework.boot</groupId>--> <groupId>org.springframework.boot</groupId>
<!-- <artifactId>spring-boot-maven-plugin</artifactId>--> <artifactId>spring-boot-maven-plugin</artifactId>
<!-- <executions>--> <executions>
<!-- <execution>--> <execution>
<!-- <goals>--> <goals>
<!-- <goal>repackage</goal>--> <goal>repackage</goal>
<!-- </goals>--> </goals>
<!-- </execution>--> </execution>
<!-- </executions>--> </executions>
<!-- </plugin>--> </plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<configuration>
<dockerfile> <plugin>
<buildArgs> <groupId>com.spotify</groupId>
<!--注意imageName一定要是符合正则[a-z0-9-_.]的,否则构建不会成功--> <artifactId>dockerfile-maven-plugin</artifactId>
<imageName>${project.artifactId}:last</imageName> <configuration>
<!--指定基础镜像--> <!-- <username>sino-tech-admin</username>-->
<baseImage>openjdk:8-jre</baseImage> <!-- <password>Fros_1234</password>-->
<!--指定远程docker地址--> <!--指定包名-->
<!--使用http协议 https 需要加TLS证书--> <repository>${project.artifactId}</repository>
<dockerHost>http://175.178.38.240:8076</dockerHost> <tag>${project.version}</tag>
<!-- &lt;!&ndash;配置TLS证书在系统中的路径&ndash;&gt;--> <buildArgs>
<!-- <dockerCertPath>/Users/root/docker-ca</dockerCertPath>--> <!--提供参数向Dockerfile传递-->
<!-- 指定默认挂载地址 --> <JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
<volumes>/mydata/service/ruoyi</volumes> </buildArgs>
<!-- 创建目录--> </configuration>
<runs>mkdir -p /mydata/service/ruoyi</runs> <!-- <configuration>-->
<workdir>/mydata/service/ruoyi</workdir> <!-- <dockerfile>-->
<entryPoint> <!-- <buildArgs>-->
["java", "-jar", "-Dspring.profiles.active=dev","/mydata/service/ruoyi/${project.build.finalName}.jar"] <!-- &lt;!&ndash;注意imageName一定要是符合正则[a-z0-9-_.]的,否则构建不会成功&ndash;&gt;-->
</entryPoint> <!-- <imageName>${project.artifactId}:last</imageName>-->
<!-- <buildArgs>--> <!-- &lt;!&ndash;指定基础镜像&ndash;&gt;-->
<!-- <JAR-FILE>target/${project.build.finalName}.jar</JAR-FILE>--> <!-- <baseImage>openjdk:8-jre</baseImage>-->
<!-- </buildArgs>--> <!-- &lt;!&ndash;指定远程docker地址&ndash;&gt;-->
<!--复制jar包到docker容器指定目录--> <!-- &lt;!&ndash;使用http协议 https 需要加TLS证书&ndash;&gt;-->
<!-- <resources>--> <!-- <dockerHost>http://175.178.38.240:8076</dockerHost>-->
<!-- <resource>--> <!-- &lt;!&ndash; &lt;!&ndash;配置TLS证书在系统中的路径&ndash;&gt;&ndash;&gt;-->
<!-- <targetPath>/mydata/service/ruoyi</targetPath>--> <!-- &lt;!&ndash; <dockerCertPath>/Users/root/docker-ca</dockerCertPath>&ndash;&gt;-->
<!-- &lt;!&ndash;jar包在项目中生成的路径即对应的target目录&ndash;&gt;--> <!-- &lt;!&ndash; 指定默认挂载地址 &ndash;&gt;-->
<!-- <directory>${project.build.directory}</directory>--> <!-- <volumes>/mydata/service/ruoyi</volumes>-->
<!-- &lt;!&ndash;指定需要复制的文件&ndash;&gt;--> <!-- &lt;!&ndash; 创建目录&ndash;&gt;-->
<!-- <include>${project.build.finalName}.jar</include>--> <!-- <runs>mkdir -p /mydata/service/ruoyi</runs>-->
<!-- </resource>--> <!-- <workdir>/mydata/service/ruoyi</workdir>-->
<!-- </resources>--> <!-- <entryPoint>-->
</buildArgs> <!-- ["java", "-jar", "-Dspring.profiles.active=dev","/mydata/service/ruoyi/${project.build.finalName}.jar"]-->
</dockerfile> <!-- </entryPoint>-->
<!-- &lt;!&ndash; <buildArgs>&ndash;&gt;-->
</configuration> <!-- &lt;!&ndash; <JAR-FILE>target/${project.build.finalName}.jar</JAR-FILE>&ndash;&gt;-->
</plugin> <!-- &lt;!&ndash; </buildArgs>&ndash;&gt;-->
</plugins> <!-- &lt;!&ndash;复制jar包到docker容器指定目录&ndash;&gt;-->
</build> <!-- &lt;!&ndash; <resources>&ndash;&gt;-->
<!-- &lt;!&ndash; <resource>&ndash;&gt;-->
</project> <!-- &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>
</project>

Loading…
Cancel
Save