@Mojo(name="build") public class BuildMojo extends AbstractDockerMojo
| Modifier and Type | Field and Description |
|---|---|
private String |
baseImage
The base image to use.
|
protected String |
buildDirectory
All resources will be copied to this directory before building the image.
|
private String |
cmd
The cmd command for the image.
|
private String |
defaultProfile |
private String |
dockerDirectory
Directory containing the Dockerfile.
|
private String |
entryPoint
The entry point of the image.
|
private Map<String,String> |
env |
private List<String> |
exposes |
private Set<String> |
exposesSet |
private org.apache.maven.plugin.PluginParameterExpressionEvaluator |
expressionEvaluator |
private String |
imageName
Built image will be given this name.
|
private String |
maintainer
The maintainer of the image.
|
private String |
profile |
private boolean |
pushImage
Flag to push image after it is built.
|
private List<org.apache.maven.model.Resource> |
resources
Resources to include in the build.
|
private boolean |
skipDockerBuild
Flag to skip docker build, making build goal a no-op.
|
protected String |
tagInfoFile
Path to JSON file to write when tagging images.
|
private boolean |
useGitCommitId
If specified as true, a tag will be generated consisting of the first 7 characters of the most
recent git commit ID, resulting in something like image:df8e8e6.
|
execution, session| Constructor and Description |
|---|
BuildMojo() |
BuildMojo(String defaultProfile) |
| Modifier and Type | Method and Description |
|---|---|
private void |
buildImage(com.spotify.docker.client.DockerClient docker,
String buildDir) |
private List<String> |
copyResources(String destination) |
private void |
createDockerFile(String directory,
List<String> filesToAdd) |
protected void |
execute(com.spotify.docker.client.DockerClient docker) |
private String |
expand(String raw) |
private String |
get(String override,
com.typesafe.config.Config config,
String path) |
private void |
loadProfile() |
private void |
validateParameters() |
dockerHost, execute, rawDockerHost@Parameter(property="dockerDirectory") private String dockerDirectory
@Parameter(property="skipDockerBuild",
defaultValue="false")
private boolean skipDockerBuild
@Parameter(property="pushImage",
defaultValue="false")
private boolean pushImage
@Parameter(property="dockerMaintainer") private String maintainer
@Parameter(property="dockerBaseImage") private String baseImage
@Parameter(property="dockerEntryPoint") private String entryPoint
@Parameter(property="dockerCmd") private String cmd
@Parameter(property="project.build.directory") protected String buildDirectory
@Parameter(property="dockerBuildProfile") private String profile
@Parameter(property="tagInfoFile",
defaultValue="${project.build.testOutputDirectory}/image_info.json")
protected String tagInfoFile
@Parameter(property="useGitCommitId",
defaultValue="false")
private boolean useGitCommitId
@Parameter(property="dockerResources") private List<org.apache.maven.model.Resource> resources
@Parameter(property="dockerImageName") private String imageName
@Parameter(property="dockerDefaultBuildProfile") private String defaultProfile
private org.apache.maven.plugin.PluginParameterExpressionEvaluator expressionEvaluator
public BuildMojo()
public BuildMojo(String defaultProfile)
protected void execute(com.spotify.docker.client.DockerClient docker)
throws org.apache.maven.plugin.MojoExecutionException,
org.eclipse.jgit.api.errors.GitAPIException,
IOException,
com.spotify.docker.client.DockerException,
InterruptedException
execute in class AbstractDockerMojoorg.apache.maven.plugin.MojoExecutionExceptionorg.eclipse.jgit.api.errors.GitAPIExceptionIOExceptioncom.spotify.docker.client.DockerExceptionInterruptedExceptionprivate void loadProfile()
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionprivate String get(String override, com.typesafe.config.Config config, String path) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionprivate String expand(String raw) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionprivate void validateParameters()
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionprivate void buildImage(com.spotify.docker.client.DockerClient docker,
String buildDir)
throws org.apache.maven.plugin.MojoExecutionException,
com.spotify.docker.client.DockerException,
IOException,
InterruptedException
org.apache.maven.plugin.MojoExecutionExceptioncom.spotify.docker.client.DockerExceptionIOExceptionInterruptedExceptionprivate void createDockerFile(String directory, List<String> filesToAdd) throws IOException
IOExceptionprivate List<String> copyResources(String destination) throws IOException
IOExceptionCopyright © 2014. All rights reserved.