zl程序教程

您现在的位置是:首页 >  其他

当前栏目

DockerMaven插件自动部署步骤

2023-09-14 09:01:56 时间

在这里插入图片描述在这里插入图片描述

	<build>
        <finalName>tensquare_euraka</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.0.5.RELEASE</version>
            </plugin>
            <plugin>
                <!--docker的maven插件,官网:https://github.com/spotify/docker-maven-plugin-->
                <groupId>com.spotify</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>0.4.13</version>
                <configuration>
                    <imageName>192.168.59.134:5000/${project.artifactId}:${project.version}}</imageName>
                    <baseImage>jdk1.8</baseImage>
                    <entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint>
                    <!-- copy the service's jar file from target into the root directory of the image -->
                    <resources>
                        <resource>
                            <targetPath>/</targetPath>
                            <directory>${project.build.directory}</directory>
                            <include>${project.build.finalName}.jar</include>
                        </resource>
                    </resources>
                    <dockerHost>http://192.168.59.134:2375</dockerHost>
                </configuration>
            </plugin>
        </plugins>
    </build>

以上配置会自动生成Dockerfile