Skip to content

Instantly share code, notes, and snippets.

@vgallet
Created December 30, 2018 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vgallet/d1d115804beef106c0e8e99f2d7aa36f to your computer and use it in GitHub Desktop.
Save vgallet/d1d115804beef106c0e8e99f2d7aa36f to your computer and use it in GitHub Desktop.
@ClassRule
public static GenericContainer mysql = new GenericContainer(
new ImageFromDockerfile("mysql-petclinic")
.withDockerfileFromBuilder(dockerfileBuilder -> {
....
})
.withExposedPorts(3306)
.withCreateContainerCmdModifier(
new Consumer<CreateContainerCmd>() {
@Override
public void accept(CreateContainerCmd createContainerCmd) {
createContainerCmd.withPortBindings(
new PortBinding(Ports.Binding.bindPort(3306), new ExposedPort(3306))
);
}
})
.waitingFor(Wait.forListeningPort());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment