resources plugin added and the target dir has been crated for building docker images

This commit is contained in:
Sergey Berezin 2019-07-24 21:29:08 +04:00
parent 590d03d96b
commit 1bcd575553
6 changed files with 35 additions and 4 deletions

2
.gitignore vendored
View file

@ -1,6 +1,6 @@
target/* target/*
petclinic-application/target/* petclinic-application/target/*
/petclinic-containers/src/main/resources/petclinic.jar petclinic-container/target/context/petclinic.jar
.settings/* .settings/*
.classpath .classpath
.editorconfig .editorconfig

View file

@ -206,5 +206,4 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View file

@ -25,6 +25,29 @@
</resource> </resource>
</resources> </resources>
<plugins> <plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>${resources-plugin.version}</version>
<executions>
<execution>
<id>copy-resources</id>
<!-- here the phase you need -->
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/context/</outputDirectory>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId> <artifactId>maven-dependency-plugin</artifactId>
@ -43,7 +66,7 @@
<version>${project.version}</version> <version>${project.version}</version>
<type>jar</type> <type>jar</type>
<overWrite>true</overWrite> <overWrite>true</overWrite>
<outputDirectory>${basedir}/src/main/resources</outputDirectory> <outputDirectory>${basedir}/target/context/</outputDirectory>
<destFileName>petclinic.jar</destFileName> <destFileName>petclinic.jar</destFileName>
</artifactItem> </artifactItem>
</artifactItems> </artifactItems>
@ -64,7 +87,7 @@
</goals> </goals>
<configuration> <configuration>
<executable>docker</executable> <executable>docker</executable>
<workingDirectory>${project.basedir}/src/main/resources</workingDirectory> <workingDirectory>${project.basedir}/target/context/</workingDirectory>
<arguments> <arguments>
<argument>build</argument> <argument>build</argument>
<argument>.</argument> <argument>.</argument>
@ -80,3 +103,7 @@
</profile> </profile>
</profiles> </profiles>
</project> </project>
<!--
/target/context/{Dockerfile, jars, resurces}
-->

View file

@ -0,0 +1,4 @@
FROM java:8
EXPOSE 8080
COPY petclinic.jar /
CMD ["java", "-jar", "petclinic.jar"]

View file

@ -45,6 +45,7 @@
<!-- Other properties --> <!-- Other properties -->
<deploy-plugin.version>2.8.1</deploy-plugin.version> <deploy-plugin.version>2.8.1</deploy-plugin.version>
<mojo-exec.version>1.6.0</mojo-exec.version> <mojo-exec.version>1.6.0</mojo-exec.version>
<resources-plugin.version>3.1.0</resources-plugin.version>
</properties> </properties>
<repositories> <repositories>