use of com.github.dockerjava.api.command.BuildImageCmd in project camel by apache.
the class AsyncDockerProducer method executeBuildImageRequest.
/**
* Produces a build image request
*
* @param client
* @param message
* @return
* @throws DockerException
*/
private BuildImageCmd executeBuildImageRequest(DockerClient client, Message message) throws DockerException {
LOGGER.debug("Executing Docker Build Image Request");
Object body = message.getBody();
BuildImageCmd buildImageCmd;
if (body != null && body instanceof InputStream) {
buildImageCmd = client.buildImageCmd((InputStream) body);
} else if (body != null && body instanceof File) {
buildImageCmd = client.buildImageCmd((File) body);
} else {
throw new DockerException("Unable to location source Image");
}
Boolean noCache = DockerHelper.getProperty(DockerConstants.DOCKER_NO_CACHE, configuration, message, Boolean.class);
if (noCache != null) {
buildImageCmd.withNoCache(noCache);
}
Boolean quiet = DockerHelper.getProperty(DockerConstants.DOCKER_QUIET, configuration, message, Boolean.class);
if (quiet != null) {
buildImageCmd.withQuiet(quiet);
}
Boolean remove = DockerHelper.getProperty(DockerConstants.DOCKER_REMOVE, configuration, message, Boolean.class);
if (remove != null) {
buildImageCmd.withRemove(remove);
}
String tag = DockerHelper.getProperty(DockerConstants.DOCKER_TAG, configuration, message, String.class);
if (tag != null) {
buildImageCmd.withTag(tag);
}
return buildImageCmd;
}
Aggregations