Precept.Containers
Docker-backed dependencies for Precept runs, via Testcontainers: start a service once for the run, hand the tests its address, and tear it down afterwards.
dotnet add package Precept.Containers
services.AddPreceptContainers(host => host.Register(
"greeter",
"my/greeter:latest",
c => c.WithPortBinding(5000, true)
.WithWaitStrategy(Wait.ForUnixContainer().UntilPortIsAvailable(5000)),
addressOverride: settings.Configuration["Greeter:Address"]));
addressOverride is the point of the module: when it is set, no container starts and the tests are
handed that address instead. The same suite then runs against a throwaway container on a developer's
machine and against a deployed environment in CI, with the environment overlay deciding which — and
no if in the tests.
Part of Precept, a .NET 10 test automation framework. Full documentation: containers · environments · startup