package org.jolokia.docker.maven;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.jolokia.docker.maven.access.DockerAccess;
import org.jolokia.docker.maven.access.DockerAccessException;
import org.jolokia.docker.maven.config.BuildImageConfiguration;
import org.jolokia.docker.maven.config.ImageConfiguration;
/**
* Goal for pushing a data-docker container
*
* @author roland
*/
@Mojo(name = "push", defaultPhase = LifecyclePhase.DEPLOY)
public class PushMojo extends AbstractDockerMojo {
/** {@inheritDoc} */
public void executeInternal(DockerAccess docker) throws DockerAccessException, MojoExecutionException {
for (ImageConfiguration imageConfig : getImages()) {
BuildImageConfiguration buildConfig = imageConfig.getBuildConfiguration();
String name = getImageName(imageConfig.getName());
if (buildConfig != null) {
docker.pushImage(name,prepareAuthConfig(name));
}
}
}
}