Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document Docker Resources #761

Open
neko-kai opened this issue Nov 30, 2019 · 0 comments
Open

Document Docker Resources #761

neko-kai opened this issue Nov 30, 2019 · 0 comments
Projects
Milestone

Comments

@neko-kai
Copy link
Member

@neko-kai neko-kai commented Nov 30, 2019

There is some documentation in the release notes for 0.9.13 and there's an example PR showing how to use them. However, it would be great to have a dedicated chapter on the microsite about Docker resources.

Release notes copied below:

Docker containers can now be declared as test dependencies / Resources in distage-testkit:

object PostgresDocker extends ContainerDef {
  val primaryPort: DockerPort = DockerPort.TCP(5432)

  override def config: Config = {
    ContainerConfig(
      image = "library/postgres:latest",
      ports = Seq(primaryPort),
      reuse = true,
    )
  }
}

Dependencies can be declared between docker containers:

object DockerPlugin extends DockerContainerModule[zio.Task] with PluginDef {
  // this container will start once `DynamoContainer` is up and running
  make[PostgresDocker.Container].fromResource {
    PostgresDocker.make[zio.Task]
      .dependOnDocker(DynamoDocker)
  }
}

Use in test:

class DBTest extends DistageBIOSpecScalatest[zio.IO] {
  "postgres docker" should {
     "respond to queries" in {
        (doobie: Transactor[zio.Task], pg: PostgresDocker.Container) =>
          doobie.trans.apply(sql"select 1")
     }
  }
}
@neko-kai neko-kai added this to the 0.9 milestone Nov 30, 2019
@neko-kai neko-kai added this to To do in DIStage via automation Nov 30, 2019
@neko-kai neko-kai modified the milestones: 0.9, 0.10 Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
DIStage
  
To do
1 participant
You can’t perform that action at this time.