[skip ci] add options to container start
This commit is contained in:
parent
6a4badbd82
commit
00da46762d
1 changed files with 11 additions and 8 deletions
|
@ -7,6 +7,8 @@ import org.domaindrivenarchitecture.provs.core.docker.platforms.*
|
||||||
import org.domaindrivenarchitecture.provs.core.platforms.UbuntuProv
|
import org.domaindrivenarchitecture.provs.core.platforms.UbuntuProv
|
||||||
import org.domaindrivenarchitecture.provs.core.processors.ContainerStartMode
|
import org.domaindrivenarchitecture.provs.core.processors.ContainerStartMode
|
||||||
|
|
||||||
|
private const val DOCKER_NOT_SUPPORTED = "docker not yet supported for "
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds a docker image if not yet existing.
|
* Builds a docker image if not yet existing.
|
||||||
*/
|
*/
|
||||||
|
@ -14,7 +16,7 @@ fun Prov.dockerProvideImage(image: DockerImage, skipIfExisting: Boolean = true,
|
||||||
if (this is UbuntuProv) {
|
if (this is UbuntuProv) {
|
||||||
return this.dockerProvideImagePlatform(image, skipIfExisting, sudo)
|
return this.dockerProvideImagePlatform(image, skipIfExisting, sudo)
|
||||||
} else {
|
} else {
|
||||||
throw RuntimeException("docker not yet supported for " + (this as UbuntuProv).javaClass)
|
throw RuntimeException(DOCKER_NOT_SUPPORTED + (this as UbuntuProv).javaClass)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +27,7 @@ fun Prov.dockerImageExists(imageName: String, sudo: Boolean = true) : Boolean {
|
||||||
if (this is UbuntuProv) {
|
if (this is UbuntuProv) {
|
||||||
return this.dockerImageExistsPlatform(imageName, sudo)
|
return this.dockerImageExistsPlatform(imageName, sudo)
|
||||||
} else {
|
} else {
|
||||||
throw RuntimeException("docker not yet supported for " + (this as UbuntuProv).javaClass)
|
throw RuntimeException(DOCKER_NOT_SUPPORTED + (this as UbuntuProv).javaClass)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,12 +42,13 @@ fun Prov.provideContainer(
|
||||||
containerName: String,
|
containerName: String,
|
||||||
imageName: String = "ubuntu",
|
imageName: String = "ubuntu",
|
||||||
startMode: ContainerStartMode = ContainerStartMode.USE_RUNNING_ELSE_CREATE,
|
startMode: ContainerStartMode = ContainerStartMode.USE_RUNNING_ELSE_CREATE,
|
||||||
sudo: Boolean = true
|
sudo: Boolean = true,
|
||||||
|
options: String = ""
|
||||||
) : ProvResult {
|
) : ProvResult {
|
||||||
if (this is UbuntuProv) {
|
if (this is UbuntuProv) {
|
||||||
return this.provideContainerPlatform(containerName, imageName, startMode, sudo)
|
return this.provideContainerPlatform(containerName, imageName, startMode, sudo, options)
|
||||||
} else {
|
} else {
|
||||||
throw RuntimeException("docker not yet supported for " + (this as UbuntuProv).javaClass)
|
throw RuntimeException(DOCKER_NOT_SUPPORTED + (this as UbuntuProv).javaClass)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +57,7 @@ fun Prov.containerRuns(containerName: String, sudo: Boolean = true) : Boolean {
|
||||||
if (this is UbuntuProv) {
|
if (this is UbuntuProv) {
|
||||||
return this.containerRunsPlatform(containerName, sudo)
|
return this.containerRunsPlatform(containerName, sudo)
|
||||||
} else {
|
} else {
|
||||||
throw RuntimeException("docker not yet supported for " + (this as UbuntuProv).javaClass)
|
throw RuntimeException(DOCKER_NOT_SUPPORTED + (this as UbuntuProv).javaClass)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +70,7 @@ fun Prov.runContainer(
|
||||||
if (this is UbuntuProv) {
|
if (this is UbuntuProv) {
|
||||||
return this.runContainerPlatform(containerName, imageName, sudo)
|
return this.runContainerPlatform(containerName, imageName, sudo)
|
||||||
} else {
|
} else {
|
||||||
throw RuntimeException("docker not yet supported for " + (this as UbuntuProv).javaClass)
|
throw RuntimeException(DOCKER_NOT_SUPPORTED + (this as UbuntuProv).javaClass)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,6 +82,6 @@ fun Prov.exitAndRmContainer(
|
||||||
if (this is UbuntuProv) {
|
if (this is UbuntuProv) {
|
||||||
return this.exitAndRmContainerPlatform(containerName, sudo)
|
return this.exitAndRmContainerPlatform(containerName, sudo)
|
||||||
} else {
|
} else {
|
||||||
throw RuntimeException("docker not yet supported for " + (this as UbuntuProv).javaClass)
|
throw RuntimeException(DOCKER_NOT_SUPPORTED + (this as UbuntuProv).javaClass)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue