org.cloudfoundry.operations.applications.Docker Java Examples
The following examples show how to use
org.cloudfoundry.operations.applications.Docker.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CloudFoundryApplicationManifestUtils.java From spring-cloud-skipper with Apache License 2.0 | 6 votes |
public static ApplicationManifest updateApplicationPath(ApplicationManifest cfApplicationManifest, Resource application) { ApplicationManifest.Builder applicationManifestBuilder = ApplicationManifest.builder() .from(cfApplicationManifest); try { if (application != null && application instanceof DockerResource) { String uriString = application.getURI().toString(); applicationManifestBuilder.docker( Docker.builder().image(uriString.replaceFirst("docker:", "")).build()) .path(null); } else { applicationManifestBuilder.path(application.getFile().toPath()); } } catch (IOException e) { throw new SkipperException(e.getMessage()); } return applicationManifestBuilder.build(); }
Example #2
Source File: CloudFoundryTaskLauncher.java From spring-cloud-deployer-cloudfoundry with Apache License 2.0 | 6 votes |
private Mono<Void> pushApplication(String name, AppDeploymentRequest request) { if (!pushTaskAppsEnabled()) { return Mono.empty(); } return requestPushApplication(PushApplicationManifestRequest.builder() .manifest(ApplicationManifest.builder() .path(getApplication(request)) .docker(Docker.builder().image(getDockerImage(request)).build()) .buildpack(buildpack(request)) .command("echo '*** First run of container to allow droplet creation.***' && sleep 300") .disk(diskQuota(request)) .environmentVariables(getEnvironmentVariables(name, request)) .healthCheckType(ApplicationHealthCheck.NONE) .memory(memory(request)) .name(name) .noRoute(true) .services(servicesToBind(request)) .build()) .stagingTimeout(this.deploymentProperties.getStagingTimeout()) .startupTimeout(this.deploymentProperties.getStartupTimeout()) .build()); }
Example #3
Source File: CloudFoundryAppDeployerTests.java From spring-cloud-deployer-cloudfoundry with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Test public void deployDockerResource() { Resource resource = new DockerResource("somecorp/someimage:latest"); given(this.applicationNameGenerator.generateAppName("test-application")).willReturn("test-application-id"); givenRequestGetApplication("test-application-id", Mono.error(new IllegalArgumentException()), Mono.just( ApplicationDetail.builder() .diskQuota(0) .id("test-application-id") .instances(1) .memoryLimit(0) .name("test-application") .requestedState("RUNNING") .runningInstances(0) .stack("test-stack") .build())); givenRequestPushApplication(PushApplicationManifestRequest.builder() .manifest(ApplicationManifest.builder() .docker(Docker.builder().image("somecorp/someimage:latest").build()) .disk(1024) .environmentVariables(defaultEnvironmentVariables()) .instances(1) .memory(1024) .name("test-application-id") .service("test-service-2") .service("test-service-1") .build()) .stagingTimeout(this.deploymentProperties.getStagingTimeout()) .startupTimeout(this.deploymentProperties.getStartupTimeout()) .build(), Mono.empty()); String deploymentId = this.deployer.deploy( new AppDeploymentRequest(new AppDefinition("test-application", Collections.emptyMap()), resource, Collections.emptyMap())); assertThat(deploymentId, equalTo("test-application-id")); }