IDEA构建Docker镜像

IDEA构建Docker镜像

第一步先让idea连接到docker不知道怎么连接的点击我

开始导入插件

                <plugin>
                    <groupId>com.spotify</groupId>
                    <artifactId>dockerfile-maven-plugin</artifactId>
                    <version>1.4.13</version>
                    <executions>
                        <execution>
                            <id>build-image</id>
                            <!--用户只需执行mvn package ,就会自动执行mvn docker:build-->
                            <phase>package</phase>
                            <goals>
                                <goal>build</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <repository>${project.artifactId}</repository>
                        <tag>${project.version}</tag>
                    </configuration>
                </plugin>

新建Dockerfile注意位置别放错如图:

编写Dockerfile

FROM openjdk:8-jre
MAINTAINER xxxxx Docker springboot "xxxxx@xxx.com"
ENV TZ Asia/Shanghai
COPY target/xxxxxxx.jar app.jar
ENTRYPOINT ["java","-Xms256m","-Xmx512m","-jar","app.jar"]

Maven添加环境变量

 依次执行clean,compile,package

 这样镜像就构建成功了

 完事

posted @ 2022-09-04 17:18  xiaocheng12138  阅读(242)  评论(0编辑  收藏  举报