项目创建
替换https://start.spring.io/
https://start.aliyun.com/
工具
热重启
docker打包
pom.xml
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <!-- Docker maven plugin --> <!--docker的操作--> <plugin> <groupId>com.spotify</groupId> <artifactId>docker-maven-plugin</artifactId> <version>1.0.0</version> <configuration> <imageName>${docker.image.prefix}/${project.artifactId}</imageName> <dockerDirectory>src/main/docker</dockerDirectory> <resources> <resource> <targetPath>/</targetPath> <directory>${project.build.directory}</directory> <include>${project.build.finalName}.jar</include> </resource> </resources> <!--docker主机ip--> <!-- <dockerHost>http://192.168.10.119:8087</dockerHost>--> <!--docker镜像名--> <imageName>yiui/${project.artifactId}</imageName> <!--docker镜像tags--> <imageTags> <imageTag>${project.version}</imageTag> </imageTags> <!--如果你想强制docker在每次新的构建上覆盖镜像tags 就加forceTags--> <forceTags>true</forceTags> </configuration> </plugin> <!--docker需要的jar的复制操作--> <plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.8</version> <executions> <execution> <phase>package</phase> <configuration> <tasks> <copy todir="src/main/docker" file="target/${project.artifactId}-${project.version}.${project.packaging}"></copy> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin>
执行命令
mvn clean package dockerfile:build
。。。