private void push(Id id) { try { PushImageCmd pushImageCmd = docker.pushImageCmd(repo(id)); logger.info("Pushing " + id + " (" + pushImageCmd.getName() + ")"); InputStream inputStream = pushImageCmd.exec(); throwExceptionIfThereIsAnError(inputStream); } catch (DockerException | IOException e) { throw new OrchestrationException(e); } }
@SuppressWarnings(("DM_DEFAULT_ENCODING")) private void build(File dockerFolder, Id id) { try { String tag = repo.tag(id); logger.info("Building " + id + " (" + tag + ")"); final boolean noCache = buildNoCache(); logger.info(" - no cache: " + noCache); final boolean removeIntermediateImages = buildRemoveIntermediateImages(); logger.info(" - remove intermediate images: " + removeIntermediateImages); final boolean quiet = buildQuiet(); logger.info(" - quiet: " + quiet); BuildImageCmd build = docker .buildImageCmd(dockerFolder) .withNoCache(noCache) .withRemove(removeIntermediateImages) .withQuiet(quiet) .withTag(tag); throwExceptionIfThereIsAnError(build.exec()); for (String otherTag : repo.conf(id).getTags()) { int lastIndexOfColon = otherTag.lastIndexOf(':'); if (lastIndexOfColon > -1) { String repositoryName = otherTag.substring(0, lastIndexOfColon); String tagName = otherTag.substring(lastIndexOfColon + 1); docker.tagImageCmd(findImageId(id), repositoryName, tagName).withForce().exec(); } } } catch (DockerException | IOException e) { throw new OrchestrationException(e); } }