-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
distage-framework-docker: Revert to deleting file locks for reused co…
…ntainers on exit, instead of as soon as possible (#971) * distage-framework-docker: Revert to deleting file locks for reused containers on exit, instead of as soon as possible Could cause conflicts if a file was deleted at the same time another resource in parallel tried to lock it * warning
- Loading branch information
Showing
5 changed files
with
86 additions
and
83 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
distage/distage-framework-docker/src/main/scala/izumi/distage/docker/ContainerDef.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package izumi.distage.docker | ||
|
||
import distage.TagK | ||
import izumi.distage.model.definition.DIResource.DIResourceBase | ||
import izumi.distage.model.providers.ProviderMagnet | ||
import izumi.fundamentals.platform.language.Quirks._ | ||
|
||
trait ContainerDef { | ||
self => | ||
type Tag | ||
type Container = DockerContainer[Tag] | ||
type Config = Docker.ContainerConfig[Tag] | ||
|
||
def config: Config | ||
|
||
/** | ||
* For binding in `ModuleDef`: | ||
* | ||
* {{{ | ||
* object KafkaDocker extends ContainerDef | ||
* object ZookeeperDocker extends ContainerDef | ||
* | ||
* make[KafkaDocker.Container].fromResource { | ||
* KafkaDocker | ||
* .make[F] | ||
* .dependOnDocker(ZookeeperDocker) | ||
* } | ||
* }}} | ||
* | ||
* To kill all containers spawned by distage, use the following command: | ||
* | ||
* {{{ | ||
* docker rm -f $(docker ps -q -a -f 'label=distage.type') | ||
* }}} | ||
* | ||
*/ | ||
final def make[F[_]: TagK](implicit tag: distage.Tag[Tag]): ProviderMagnet[DockerContainer.ContainerResource[F, Tag] with DIResourceBase[F, Container]] = { | ||
tag.discard() | ||
DockerContainer.resource[F](this) | ||
} | ||
|
||
final def copy(config: Config): ContainerDef.Aux[self.Tag] = { | ||
@inline def c = config | ||
new ContainerDef { | ||
override type Tag = self.Tag | ||
override def config: Config = c | ||
} | ||
} | ||
} | ||
|
||
object ContainerDef { | ||
type Aux[T] = ContainerDef { type Tag = T } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters