Giriş
Şu satırı dahil ederiz
import org.testcontainers.images.builder.ImageFromDockerFile;
withDockerfile metodu
ÖrnekŞöyle yaparız
ImageFromDockerfile image = new ImageFromDockerfile() .withDockerfile(Paths.get("Dockerfile.txt")); GenericContainer container = new GenericContainer(image) .withEnv(...) .withExposedPorts(...);
// Dockerfile FROM opensearchproject/opensearch:1.1.0 # Install a plugin RUN /usr/share/opensearch/bin/opensearch-plugin install analysis-phonetic
Şöyle yaparız
@Rulepublic GenericContainer<?> server = new GenericContainer(new ImageFromDockerFile().withDockerfileFromBuilder(builder ->builder.from("alpine:3.16").run("apk add --update nginx").cmd("nginx", "-g", "deamon off;").build())).withExposedPorts(80);
Hiç yorum yok:
Yorum Gönder