in plugins/docker/component-image/src/main/java/co/elastic/gradle/dockercomponent/DockerComponentLocalImport.java [110:163]
public void localImport() throws IOException {
final Path contextRoot = getProject().getBuildDir().toPath()
.resolve(getName())
.resolve("context");
getFilesystemOperations().sync(spec -> {
spec.into(contextRoot);
spec.with(rootCopySpec);
}
);
final JibActions actions = new JibActions();
actions.buildToDaemon(
getTag().get(),
getImageIdFile().get(),
getInstructions().get().get(Architecture.current())
.stream()
.filter(jibInstruction -> !(jibInstruction instanceof ChangingLabel))
.map(instruction -> {
if (isStaticFrom() && instruction instanceof From from) {
final Path lockfilePath = RegularFileUtils.toPath(getLockFileLocation());
if (!Files.exists(lockfilePath)) {
throw new GradleException("A lockfile does not exist, run the `" +
DockerComponentPlugin.LOCK_FILE_TASK_NAME + "` task to generate it."
);
}
final ComponentLockfile lockFile;
try {
lockFile = ComponentLockfile.parse(
Files.newBufferedReader(lockfilePath)
);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
return actions.addDigestFromLockfile(
lockFile.images().get(Architecture.current()), from, getProviderFactory()
);
} else {
return instruction;
}
})
.collect(Collectors.toList()),
contextRoot
);
Files.writeString(getMarker().toPath(), getTag().get());
getLogger().lifecycle("Image with Id {} tagged as {}",
RegularFileUtils.readString(getImageIdFile().get()).trim(),
getTag().get()
);
if (getLogger().isInfoEnabled()) {
(new DockerUtils(getExecOperations())).exec(execSpec -> {
execSpec.commandLine("docker", "inspect", getTag().get());
});
}
}