A Maven Docker example using a template file and the Maven Resources Plugin.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

86 lines
3.7 KiB

  1. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  3. <modelVersion>4.0.0</modelVersion>
  4. <groupId>at.flortsch</groupId>
  5. <artifactId>maven-docker-example</artifactId>
  6. <version>0.0.1-SNAPSHOT</version>
  7. <name>Maven Docker Example</name>
  8. <description>Using a template and the Maven Resources Plugin to generate a Dockerfile which is used on the Docker CLI to build a Docker image.</description>
  9. <properties>
  10. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  11. <maven.compiler.source>1.8</maven.compiler.source>
  12. <maven.compiler.target>1.8</maven.compiler.target>
  13. <application.mainclass>at.flortsch.example.docker.Main</application.mainclass>
  14. <application.dependencies>lib</application.dependencies>
  15. <application.workdir>application</application.workdir>
  16. </properties>
  17. <dependencies>
  18. <dependency>
  19. <groupId>io.vertx</groupId>
  20. <artifactId>vertx-core</artifactId>
  21. <version>3.4.2</version>
  22. </dependency>
  23. <dependency>
  24. <groupId>io.vertx</groupId>
  25. <artifactId>vertx-web</artifactId>
  26. <version>3.4.2</version>
  27. </dependency>
  28. </dependencies>
  29. <build>
  30. <plugins>
  31. <plugin>
  32. <artifactId>maven-dependency-plugin</artifactId>
  33. <version>3.0.1</version>
  34. <executions>
  35. <execution>
  36. <phase>prepare-package</phase>
  37. <goals>
  38. <goal>copy-dependencies</goal>
  39. </goals>
  40. <configuration>
  41. <includeScope>runtime</includeScope>
  42. <outputDirectory>${project.build.directory}/${application.dependencies}</outputDirectory>
  43. </configuration>
  44. </execution>
  45. </executions>
  46. </plugin>
  47. <plugin>
  48. <artifactId>maven-jar-plugin</artifactId>
  49. <version>3.0.2</version>
  50. <configuration>
  51. <archive>
  52. <manifest>
  53. <addClasspath>true</addClasspath>
  54. <classpathPrefix>${application.dependencies}</classpathPrefix>
  55. <mainClass>${application.mainclass}</mainClass>
  56. <!-- match with base version string naming -->
  57. <useUniqueVersions>false</useUniqueVersions>
  58. </manifest>
  59. </archive>
  60. </configuration>
  61. </plugin>
  62. <plugin>
  63. <artifactId>maven-resources-plugin</artifactId>
  64. <version>3.0.2</version>
  65. <executions>
  66. <execution>
  67. <phase>generate-resources</phase>
  68. <goals>
  69. <goal>copy-resources</goal>
  70. </goals>
  71. <configuration>
  72. <outputDirectory>${project.build.directory}</outputDirectory>
  73. <resources>
  74. <resource>
  75. <directory>src/main/docker</directory>
  76. <filtering>true</filtering>
  77. </resource>
  78. </resources>
  79. </configuration>
  80. </execution>
  81. </executions>
  82. </plugin>
  83. </plugins>
  84. </build>
  85. </project>