Skip to content

Instantly share code, notes, and snippets.

@vgallet
Created December 29, 2018 18:59
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save vgallet/98292e5c40aa4ee4d174a43ce3c3d6f1 to your computer and use it in GitHub Desktop.
@ClassRule
public static GenericContainer mysql = new GenericContainer(
new ImageFromDockerfile("mysql-petclinic")
.withDockerfileFromBuilder(dockerfileBuilder -> {
dockerfileBuilder.from("mysql:5.7.8")
.env("MYSQL_ROOT_PASSWORD", "root_password")
.env("MYSQL_DATABASE", "petclinic")
.env("MYSQL_USER", "petclinic")
.env("MYSQL_PASSWORD", "petclinic")
.add("a_schema.sql", "/docker-entrypoint-initdb.d")
.add("b_data.sql", "/docker-entrypoint-initdb.d");
})
.withFileFromClasspath("a_schema.sql", "db/mysql/schema.sql")
.withFileFromClasspath("b_data.sql", "db/mysql/data.sql"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment