Search in sources :

Example 1 with ContainerConfig

use of org.springframework.boot.buildpack.platform.docker.type.ContainerConfig in project spring-boot by spring-projects.

the class Lifecycle method run.

private void run(Phase phase) throws IOException {
    Consumer<LogUpdateEvent> logConsumer = this.log.runningPhase(this.request, phase.getName());
    ContainerConfig containerConfig = ContainerConfig.of(this.builder.getName(), phase::apply);
    ContainerReference reference = createContainer(containerConfig);
    try {
        this.docker.container().start(reference);
        this.docker.container().logs(reference, logConsumer::accept);
        ContainerStatus status = this.docker.container().wait(reference);
        if (status.getStatusCode() != 0) {
            throw new BuilderException(phase.getName(), status.getStatusCode());
        }
    } finally {
        this.docker.container().remove(reference, true);
    }
}
Also used : ContainerConfig(org.springframework.boot.buildpack.platform.docker.type.ContainerConfig) LogUpdateEvent(org.springframework.boot.buildpack.platform.docker.LogUpdateEvent) ContainerStatus(org.springframework.boot.buildpack.platform.docker.type.ContainerStatus) ContainerReference(org.springframework.boot.buildpack.platform.docker.type.ContainerReference)

Aggregations

LogUpdateEvent (org.springframework.boot.buildpack.platform.docker.LogUpdateEvent)1 ContainerConfig (org.springframework.boot.buildpack.platform.docker.type.ContainerConfig)1 ContainerReference (org.springframework.boot.buildpack.platform.docker.type.ContainerReference)1 ContainerStatus (org.springframework.boot.buildpack.platform.docker.type.ContainerStatus)1