use of org.talend.sdk.component.maven.docker.JibHelper in project component-runtime by Talend.
the class ImageM2Mojo method doExecute.
@Override
public void doExecute() throws MojoExecutionException {
try (final JibHelper jibHelper = new JibHelper(getLog(), project.getBuild().getDirectory(), layersCacheDirectory, repository, dockerEnvironment, dockerExecutable, laggyPushWorkaround)) {
jibHelper.prepare(project.getArtifactId(), project.getVersion(), project.getProperties(), fromImage, toImage, creationTime, workingDirectory, this::createWorkingDirectory, environment, labels);
addLayers(jibHelper.getBuilder());
if (ports != null) {
ports.stream().map(Port::tcp).forEach(jibHelper.getBuilder()::addExposedPort);
}
getLog().info("Creating the image (can be long)");
jibHelper.build("Talend Image Maven Plugin", () -> ofNullable(session.getSettings().getServer(repository)).map(it -> settingsDecrypter.decrypt(new DefaultSettingsDecryptionRequest(it))).map(SettingsDecryptionResult::getServer).orElse(null));
if (versionProperty != null) {
jibHelper.setProperties(project, versionProperty);
}
} catch (final Exception e) {
throw new MojoExecutionException(e.getMessage(), e);
} finally {
if (m2Root.exists()) {
try {
Files.walkFileTree(m2Root.toPath(), new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException {
file.toFile().delete();
return super.visitFile(file, attrs);
}
@Override
public FileVisitResult postVisitDirectory(final Path dir, final IOException exc) throws IOException {
dir.toFile().delete();
return super.postVisitDirectory(dir, exc);
}
});
} catch (final IOException e) {
getLog().warn(e.getMessage(), e);
}
}
}
}
use of org.talend.sdk.component.maven.docker.JibHelper in project component-runtime by Talend.
the class SingerMojo method doExecute.
private void doExecute() throws MojoExecutionException {
try (final JibHelper jibHelper = new JibHelper(getLog(), project.getBuild().getDirectory(), layersCacheDirectory, repository, dockerEnvironment, dockerExecutable, laggyPushWorkaround)) {
jibHelper.prepare(project.getArtifactId(), project.getVersion(), project.getProperties(), fromImage, toImage, creationTime, workingDirectory, () -> "/opt/talend/singer/component/" + project.getArtifactId(), environment, labels);
configure(jibHelper);
getLog().info("Creating the image (can be long)");
jibHelper.build("Talend Singer Maven Plugin", () -> ofNullable(session.getSettings().getServer(repository)).map(it -> settingsDecrypter.decrypt(new DefaultSettingsDecryptionRequest(it))).map(SettingsDecryptionResult::getServer).orElse(null));
if (versionProperty != null) {
jibHelper.setProperties(project, versionProperty);
}
} catch (final Exception e) {
throw new MojoExecutionException(e.getMessage(), e);
}
}
Aggregations