mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-21 06:45:49 +00:00
Docker build added (use profile -Pdocker-build)
This commit is contained in:
parent
7fa4d33e39
commit
590d03d96b
5 changed files with 32 additions and 10 deletions
|
@ -10,12 +10,10 @@
|
|||
<version>2.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>petclinic-containers</artifactId>
|
||||
<artifactId>petclinic-container</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>petclinic-containers</name>
|
||||
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>docker-build</id>
|
||||
|
@ -43,15 +41,36 @@
|
|||
<groupId>org.springframework.samples</groupId>
|
||||
<artifactId>petclinic-application</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>${project.packaging}</type>
|
||||
<type>jar</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${basedir}/src/main/resources</outputDirectory>
|
||||
<destFileName>petclinic.jar</destFileName>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
<outputDirectory>${docker.build.directory}</outputDirectory>
|
||||
<overWriteReleases>true</overWriteReleases>
|
||||
<overWriteSnapshots>true</overWriteSnapshots>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>${mojo-exec.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>docker-package</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>docker</executable>
|
||||
<workingDirectory>${project.basedir}/src/main/resources</workingDirectory>
|
||||
<arguments>
|
||||
<argument>build</argument>
|
||||
<argument>.</argument>
|
||||
<argument>-t</argument>
|
||||
<argument>${project.groupId}/${project.artifactId}:${project.version}</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
@ -60,5 +79,4 @@
|
|||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
4
petclinic-container/src/main/resources/dockerfile
Normal file
4
petclinic-container/src/main/resources/dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM java:8
|
||||
EXPOSE 8080
|
||||
COPY petclinic.jar /
|
||||
CMD ["java", "-jar", "petclinic.jar"]
|
BIN
petclinic-container/src/main/resources/petclinic.jar
Normal file
BIN
petclinic-container/src/main/resources/petclinic.jar
Normal file
Binary file not shown.
4
pom.xml
4
pom.xml
|
@ -26,7 +26,7 @@
|
|||
|
||||
<modules>
|
||||
<module>petclinic-application</module>
|
||||
<module>petclinic-containers</module>
|
||||
<module>petclinic-container</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
@ -44,6 +44,7 @@
|
|||
|
||||
<!-- Other properties -->
|
||||
<deploy-plugin.version>2.8.1</deploy-plugin.version>
|
||||
<mojo-exec.version>1.6.0</mojo-exec.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
|
@ -83,5 +84,4 @@
|
|||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
</project>
|
||||
|
|
Loading…
Reference in a new issue