testcontainers / testcontainers-dotnet

A library to support tests with throwaway instances of Docker containers for all compatible .NET Standard versions.
https://dotnet.testcontainers.org
MIT License
3.65k stars 250 forks source link

fix: Trim relative path indicators from Dockerfile path #1203

Closed HofmeisterAn closed 1 week ago

HofmeisterAn commented 1 week ago

What does this PR do?

The pull request removes the relative path indicators from the Dockerfile path in the WithDockerfile(string) image builder API.

Why is it important?

This change is necessary to prevent issues when a developer passes a relative path to the API, such as ./Dockerfile. If the Dockerfile path starts with a relative path indicator, the .dockerignore negate pattern that makes sure the Dockerfile is always included in the tarball might not work correct. This can result in the Dockerfile not being included. Building the image fails with the following or a similar error:

Cannot locate specified Dockerfile: ./Dockerfile

Trimming the relative path indicators prevents a follow-up issue. If the path contains relative path indicators, setting the ImageBuildParameters.Dockerfile property causes the build to fail as well.

Related issues

netlify[bot] commented 1 week ago

Deploy Preview for testcontainers-dotnet ready!

Name Link
Latest commit 99abf20d56a4bcceb46a157a270a1e5871c6aca7
Latest deploy log https://app.netlify.com/sites/testcontainers-dotnet/deploys/66766fe5cd8f44000870e3ce
Deploy Preview https://deploy-preview-1203--testcontainers-dotnet.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.