From 734fb5205492fbf154588e8fd09e4dde47cd3a6e Mon Sep 17 00:00:00 2001 From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com> Date: Fri, 17 May 2024 17:18:45 +0200 Subject: [PATCH] docs: Add default image build policy --- docs/api/create_docker_image.md | 1 + src/Testcontainers/Builders/ImageFromDockerfileBuilder.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/api/create_docker_image.md b/docs/api/create_docker_image.md index 9366a6867..aa2afb3c7 100644 --- a/docs/api/create_docker_image.md +++ b/docs/api/create_docker_image.md @@ -94,6 +94,7 @@ _ = new ImageFromDockerfileBuilder() | `WithName` | Sets the image name e.g. `-t`, `--tag "testcontainers:0.1.0"`. | | `WithDockerfile` | Sets the name of the `Dockerfile`. | | `WithDockerfileDirectory` | Sets the build context (directory path that contains the `Dockerfile`). | +| `WithImageBuildPolicy` | Specifies an image build policy to determine when an image is built. | | `WithDeleteIfExists` | Will remove the image if it already exists. | | `WithBuildArgument` | Sets build-time variables e.g `--build-arg "MAGIC_NUMBER=42"`. | | `WithCreateParameterModifier` | Allows low level modifications of the Docker image build parameter. | diff --git a/src/Testcontainers/Builders/ImageFromDockerfileBuilder.cs b/src/Testcontainers/Builders/ImageFromDockerfileBuilder.cs index 27ca60591..4ec2387c6 100644 --- a/src/Testcontainers/Builders/ImageFromDockerfileBuilder.cs +++ b/src/Testcontainers/Builders/ImageFromDockerfileBuilder.cs @@ -18,6 +18,7 @@ namespace DotNet.Testcontainers.Builders /// .WithDockerEndpoint(TestcontainersSettings.OS.DockerEndpointAuthConfig) /// .WithLabel(DefaultLabels.Instance) /// .WithCleanUp(true) + /// .WithImageBuildPolicy(PullPolicy.Always) /// .WithDockerfile("Dockerfile") /// .WithDockerfileDirectory(Directory.GetCurrentDirectory()) /// .WithName(new DockerImage("localhost/testcontainers", Guid.NewGuid().ToString("D"), string.Empty))