private String getImageName(CubeContainer containerConfiguration, String name) { String image; if (containerConfiguration.getImage() != null) { image = containerConfiguration.getImage().toImageRef(); } else { if (containerConfiguration.getBuildImage() != null) { BuildImage buildImage = containerConfiguration.getBuildImage(); if (buildImage.getDockerfileLocation() != null) { Map<String, Object> params = new HashMap<String, Object>(); //(containerConfiguration, BUILD_IMAGE); params.put("noCache", buildImage.isNoCache()); params.put("remove", buildImage.isRemove()); params.put("dockerFileLocation", buildImage.getDockerfileLocation()); params.put("dockerFileName", buildImage.getDockerfileName()); image = this.buildImage(buildImage.getDockerfileLocation(), name, params); } else { throw new IllegalArgumentException( "A tar file with Dockerfile on root or a directory with a Dockerfile should be provided."); } } else { throw new IllegalArgumentException( String.format( "Current configuration file does not contain %s nor %s parameter and one of both should be provided.", IMAGE, BUILD_IMAGE)); } } return image; }
private String getImageName(CubeContainer containerConfiguration, String name) { String image; if (containerConfiguration.getImage() != null) { image = containerConfiguration.getImage().toImageRef(); } else { if (containerConfiguration.getBuildImage() != null) { BuildImage buildImage = containerConfiguration.getBuildImage(); if (buildImage.getDockerfileLocation() != null) { Map<String, Object> params = new HashMap<String, Object>(); //(containerConfiguration, BUILD_IMAGE); params.put("noCache", buildImage.isNoCache()); params.put("remove", buildImage.isRemove()); params.put("dockerFileLocation", buildImage.getDockerfileLocation()); params.put("dockerFileName", buildImage.getDockerfileName()); image = this.buildImage(buildImage.getDockerfileLocation(), name, params); } else { throw new IllegalArgumentException( "A tar file with Dockerfile on root or a directory with a Dockerfile should be provided."); } } else { throw new IllegalArgumentException( String.format( "Current configuration file does not contain %s nor %s parameter and one of both should be provided.", IMAGE, BUILD_IMAGE)); } } return image; }