use of io.fabric8.maven.docker.util.ImageName in project docker-maven-plugin by fabric8io.
the class UrlBuilderTest method getImage.
@Test
public void getImage() throws URISyntaxException {
UrlBuilder builder = new UrlBuilder("", "1.0");
assertEquals(new URI("/1.0/images/n1%3Alatest/get"), new URI(builder.getImage(new ImageName("n1:latest"))));
}
use of io.fabric8.maven.docker.util.ImageName in project docker-maven-plugin by fabric8io.
the class BuildMojo method executeInternal.
@Override
protected void executeInternal(ServiceHub hub) throws DockerAccessException, MojoExecutionException {
if (skipBuild) {
return;
}
List<ImageConfiguration> resolvedImages = getResolvedImages();
if (resolvedImages.isEmpty()) {
// No Configuration found, so build one up dynamically.
if (imageName == null) {
/*
* Image name defaults to:
* `${project.groupId}/${project.artifactId}:${project.version}`
*/
imageName = project.getGroupId() + "/" + project.getArtifactId() + ":" + project.getVersion();
}
ImageConfiguration aDefaultImageConfig = ImageConfiguration.getDefaultImageConfiguration(imageName, project.getBasedir().getAbsolutePath());
processImageConfig(hub, aDefaultImageConfig);
return;
} else {
// Iterate over all the ImageConfigurations and process one by one
for (ImageConfiguration imageConfig : resolvedImages) {
processImageConfig(hub, imageConfig);
}
}
}
use of io.fabric8.maven.docker.util.ImageName in project docker-maven-plugin by fabric8io.
the class SaveMojo method getFileName.
private String getFileName(String iName) throws MojoExecutionException {
String configuredFileName = getConfiguredFileName();
if (configuredFileName != null) {
return configuredFileName;
}
if (saveAlias != null) {
return completeCalculatedFileName(saveAlias + "-" + project.getVersion() + "." + STANDARD_ARCHIVE_COMPRESSION.getFileSuffix());
}
ImageName imageName = new ImageName(iName);
return completeCalculatedFileName(imageName.getSimpleName() + "-" + imageName.getTag()) + "." + STANDARD_ARCHIVE_COMPRESSION.getFileSuffix();
}
use of io.fabric8.maven.docker.util.ImageName in project ballerina by ballerina-lang.
the class TestUtils method deleteDockerImage.
public static void deleteDockerImage(String imageName) {
if (!imageName.contains(":")) {
imageName += ":" + Constants.IMAGE_VERSION_LATEST;
}
DockerClient client = new io.fabric8.docker.client.DefaultDockerClient();
List<ImageDelete> imageDeleteList = client.image().withName(imageName).delete().force().andPrune(false);
for (ImageDelete imageDelete : imageDeleteList) {
imageDelete.getDeleted();
imageDelete.getUntagged();
}
}
use of io.fabric8.maven.docker.util.ImageName in project ballerina by ballerina-lang.
the class DefaultBallerinaDockerClient method buildImage.
/*
Execute a Docker image build using Fabric8 DSL.
*/
private void buildImage(String dockerEnv, String imageName, Path tmpDir, String buildArgs) throws InterruptedException, IOException {
DockerClient client = getDockerClient(dockerEnv);
OutputHandle buildHandle = client.image().build().withRepositoryName(imageName).withNoCache().alwaysRemovingIntermediate().withBuildArgs(buildArgs).usingListener(new DockerBuilderEventListener()).fromFolder(tmpDir.toString());
buildDone.await();
buildHandle.close();
client.close();
}
Aggregations