Skip to content

Conversation

LarryNorth
Copy link

@LarryNorth LarryNorth commented May 18, 2025

Support Dockerfile-Specific .dockerignore files per the Docker Manual.

@LarryNorth LarryNorth requested a review from a team as a code owner May 18, 2025 17:58
if (dockerFileSpecificIgnoreFile.exists()) {
return dockerFileSpecificIgnoreFile;
} else {
return new File(dockerFileDirectory, ".dockerignore");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be falling back to the .dockerignore in the root directory of the context? If so, the test(s) may need to be updated to reflect this behavior.

Suggested change
return new File(dockerFileDirectory, ".dockerignore");
return new File(baseDirectory, ".dockerignore");

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I implemented your suggestion and added a test for falling back to the default .dockerignore. The tests that existed before this pull request already relied on the fall back behavior.

…-files' into dockerfile-specific-dockerignore-files

# Conflicts:
#	docker-java-core/src/main/java/com/github/dockerjava/core/dockerfile/Dockerfile.java
#	docker-java/src/test/java/com/github/dockerjava/core/dockerfile/DockerfileAddMultipleFilesTest.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants