在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):syncdk/docker-compose-maven-plugin开源软件地址(OpenSource Url):https://github.com/syncdk/docker-compose-maven-plugin开源编程语言(OpenSource Language):Java 60.1%开源软件介绍(OpenSource Introduction):Docker Compose Maven PluginQuickstartAvailable on Maven Central. <dependency>
<groupId>com.dkanejs.maven.plugins</groupId>
<artifactId>docker-compose-maven-plugin</artifactId>
<version>$VERSION</version>
</dependency> AboutMaven plugin for running basic This can be used as part of the Maven lifecycle or as a utility to bring This plugin is designed to be light, fast and with minimum dependencies (only those required by Maven). UsageGoals
PropertiescomposeFile
The Plugin assumes your docker file is in This can be changed in the configuration section of the plugin: <configuration>
<composeFile>${project.basedir}/docker-compose.yml</composeFile>
</configuration> If the property composeFiles
This can be configured in the configuration section of the plugin: <configuration>
<composeFiles>
<composeFile>${project.basedir}/docker-compose.yml</composeFile>
<composeFile>${project.basedir}/docker-compose.override.yml</composeFile>
</composeFiles>
</configuration> envFile
This can be configured in the configuration section of the plugin: <configuration>
<envFile>${project.basedir}/.env</envFile>
</configuration> envVars
This can be configured in the configuration section of the plugin: <configuration>
<envVars>
<serviceName>${project.groupId}.${project.artifactId}</serviceName>
</envVars>
</configuration> This allows you to parameterize your version: '3.2'
services:
service:
image: busybox
container_name: ${serviceName}-1 services
This property configures the plugin to only execute the commands on the services specified. This can be configured in the configuration section of the plugin: <configuration>
<services>
<service>service-1</composeFile>
<service>service-2</composeFile>
</services>
</configuration> The following example will only start services: <configuration>
<services>
<service>test-1</composeFile>
<service>test-2</composeFile>
</services>
</configuration> Against the following version: '3.2'
services:
test-1:
image: busybox
container_name: container-1
test-2:
image: busybox
container_name: container-2
test-3:
image: busybox
container_name: container-3 Equivalent
detachedMode
This adds The plugin will not run in detached mode by default. This can be changed in the configuration section of the plugin: <configuration>
<detachedMode>true</detachedMode>
</configuration> removeVolumes
This adds The plugin will not remove any volumes you create when using the This can be changed in the configuration section of the plugin: <configuration>
<removeVolumes>true</removeVolumes>
</configuration> apiVersion
<configuration>
<apiVersion>1.22</apiVersion>
</configuration> verbose
<configuration>
<verbose>true</verbose>
</configuration> skip
<configuration>
<skip>true</skip>
</configuration> projectName
<configuration>
<projectName>customProjectName</projectName>
</configuration> host
<configuration>
<host>unix:///var/run/docker.sock</host>
</configuration> build
This adds The plugin will not build images first by default. This can be changed in the configuration section of the plugin: <configuration>
<build>true</build>
</configuration> removeOrphans
This adds The plugin will not remove orphans by default. This can be changed in the configuration section of the plugin: <configuration>
<removeOrphans>true</removeOrphans>
</configuration> removeImages
This adds The plugin will not remove images by default. This can be changed in the configuration section of the plugin: <configuration>
<removeImages>true</removeImages>
</configuration> Additional option <configuration>
<removeImages>true</removeImages>
<removeImagesType>local</removeImagesType>
</configuration> ignorePullFailures
This adds The plugin will not ignore pull failures by default. This can be changed in the configuration section of the plugin: <configuration>
<ignorePullFailures>true</ignorePullFailures>
</configuration> Environment variablesYou can add env vars to your <configuration>
...
<envVars>
<jdkImageType>openjdk</jdkImageType>
<dockerImageTag>0.1.1</dockerImageTag>
</envVars>
...
</configuration> This will add Build argumentsThe build arguments for the <configuration>
<buildArgs>
...
</buildArgs>
</configuration> forceRmAdds <configuration>
<buildArgs>
...
<forceRm>true</forceRm>
...
</buildArgs>
</configuration> noCacheAdds <configuration>
<buildArgs>
...
<noCache>true</noCache>
...
</buildArgs>
</configuration> alwaysPullAdds <configuration>
<buildArgs>
...
<alwaysPull>true</alwaysPull>
...
</buildArgs>
</configuration> argsAdds <configuration>
<buildArgs>
...
<args>
<foo>bar</foo>
<far>boor</far>
</args>
...
</buildArgs>
</configuration> This will add ConfigurationDefaultBelow will allow use of the plugin from the <build>
<plugins>
<plugin>
<groupId>com.dkanejs.maven.plugins</groupId>
<artifactId>docker-compose-maven-plugin</artifactId>
<version>$VERSION</version>
</plugin>
</plugins>
</build> This assumes the compose file is in the default location and will not run in any phase of the build. AdvancedBelow has customised the location of the <build>
<plugins>
<plugin>
<groupId>com.dkanejs.maven.plugins</groupId>
<artifactId>docker-compose-maven-plugin</artifactId>
<version>$VERSION</version>
<executions>
<execution>
<id>pull</id>
<phase>verify</phase>
<goals>
<goal>pull</goal>
</goals>
<configuration>
<composeFile>${project.basedir}/docker-compose.yml</composeFile>
<ignorePullFailures>true</ignorePullFailures>
</configuration>
</execution>
<execution>
<id>up</id>
<phase>verify</phase>
<goals>
<goal>up</goal>
</goals>
<configuration>
<composeFile>${project.basedir}/docker-compose.yml</composeFile>
<detachedMode>true</detachedMode>
</configuration>
</execution>
<execution>
<id>down</id>
<phase>verify</phase>
<goals>
<goal>down</goal>
</goals>
<configuration>
<composeFile>${project.basedir}/docker-compose.yml</composeFile>
<removeVolumes>true</removeVolumes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build> This will run the following as part of the
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论