开源软件名称(OpenSource Name):spotify/dockerfile-maven开源软件地址(OpenSource Url):https://github.com/spotify/dockerfile-maven开源编程语言(OpenSource Language):Java 77.1%开源软件介绍(OpenSource Introduction):Dockerfile MavenStatus: matureAt this point, we're not developing or accepting new features or even fixing non-critical bugs. This Maven plugin integrates Maven with Docker. The design goals are:
This project adheres to the Open Code of Conduct. By participating, you are expected to honor this code. See the changelog for a list of releases Set-upThis plugin requires Java 7 or later and Apache Maven 3 or later (dockerfile-maven-plugin <=1.4.6 needs Maven >= 3, and for other cases, Maven >= 3.5.2). To run the integration tests or to use the plugin in practice, a working Docker set-up is needed. ExampleFor more examples, see the integration test directory. In particular, the advanced test showcases a
full service consisting of two micro-services that are integration
tested using This configures the actual plugin to build your image with <plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>${dockerfile-maven-version}</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
<configuration>
<repository>spotify/foobar</repository>
<tag>${project.version}</tag>
<buildArgs>
<JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin> A corresponding
Important note The most Maven-ish way to reference the build artifact would probably
be to use the Do not use What does it give me?There are many advantages to using this plugin for your builds. Faster build timesThis plugin lets you leverage Docker cache more consistently, vastly
speeding up your builds by letting you cache Maven dependencies in
your image. It also encourages avoiding the Consistent build lifecycleYou no longer have to say something like:
Instead, it is simply enough to say:
With the basic configuration, this will make sure that the image is built and pushed at the correct times. Depend on Docker images of other servicesYou can depend on the Docker information of another project, because this plugin attaches project metadata when it builds Docker images. Simply add this information to any project: <dependency>
<groupId>com.spotify</groupId>
<artifactId>foobar</artifactId>
<version>1.0-SNAPSHOT</version>
<type>docker-info</type>
</dependency> Now, you can read information about the Docker image of the project that you depended on: String imageName = getResource("META-INF/docker/com.spotify/foobar/image-name"); This is great for an integration test where you want the latest version of another project's Docker image. Note that you have to register a Maven extension in your POM (or a
parent POM) in order for the <build>
<extensions>
<extension>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-extension</artifactId>
<version>${version}</version>
</extension>
</extensions>
</build> Use other Docker tools that rely on DockerfilesYour project(s) look like so:
You can now use these projects with Fig or docker-compose or some
other system that works with Dockerfiles. For example, a
service-a:
build: a/
ports:
- '80'
service-b:
build: b/
links:
- service-a Now, UsageSee usage docs. AuthenticationSee authentication docs. ReleasingTo cut the Maven release:
We use
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论