Fix Dockerfile not located when added to dockerignore#2272
Merged
mdelapenya merged 3 commits intotestcontainers:mainfrom Feb 29, 2024
danvergara:fix-dockerfile-dockerignore
Merged
Fix Dockerfile not located when added to dockerignore#2272mdelapenya merged 3 commits intotestcontainers:mainfrom danvergara:fix-dockerfile-dockerignore
mdelapenya merged 3 commits intotestcontainers:mainfrom
danvergara:fix-dockerfile-dockerignore
Conversation
…replicate the bug 2203
…file to the buildcontext 2203
…er the new changes 2203
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Contributor
Author
|
@mdelapenya is it normal that the Rootless pipeline always fails? I keep seeing it failing across the latest pull requests. |
mdelapenya
approved these changes
Feb 29, 2024
Member
mdelapenya
left a comment
There was a problem hiding this comment.
LGTM, thanks for investigating and submitting a fix. Much appreciated!
mdelapenya
added a commit
to jespino/testcontainers-go
that referenced
this pull request
Mar 1, 2024
* main: chore: bump Go version to 1.21 (testcontainers#2292) chore(deps): bump github.com/ClickHouse/clickhouse-go/v2 (testcontainers#2226) feat: WithLogger ContainerCustomizer support (testcontainers#2259) chore(deps): bump github.com/jackc/pgx/v5 in /modules/cockroachdb (testcontainers#2217) Move the file and mounts tests into a test package (testcontainers#2270) Fix Dockerfile not located when added to dockerignore (testcontainers#2272)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
When the user adds
Dockerfileto the.dockerignorefile,testcontainersis not able to build the image with error:Error response from daemon: Cannot locate specified DockerfileThis is because
testcontainersdoesn't include theDockerfileto thebuildcontexton purpose, it only expects to do so, if it is not included on theignorefile. The docker client doesn't this either, the Docker cli is aware of this and maintainers have addressed this limitation in this PR long ago as the have tweaked the client to include both files to the build context.To fix this, I added the
.dockerignorefile in the current context and the targetDockefileto the Build Context.archive.TarOptionsstruct has a key on it to include files to the archive:Why is it important?
The motivation is that some developers don't want to include the
Dockerfileto the result image to keep it as minimal as possible.Related issues
Closes #2203