summaryrefslogtreecommitdiff
path: root/docker/utils/utils.py
diff options
context:
space:
mode:
authorJoffrey F <joffrey@docker.com>2016-02-08 16:46:32 -0800
committerJoffrey F <joffrey@docker.com>2016-02-09 12:11:30 -0800
commit90760cfe1d971a88c55e52456558085af7e8680c (patch)
tree4d7d2ef534947044a28cfe3fdc3372ca0f6f226d /docker/utils/utils.py
parent575305fdba6c57f06d605920e01b5e1d6b952d3e (diff)
downloaddocker-py-926-ignored_dockerfiles.tar.gz
Never exclude Dockerfile from the build context.926-ignored_dockerfiles
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'docker/utils/utils.py')
-rw-r--r--docker/utils/utils.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/docker/utils/utils.py b/docker/utils/utils.py
index 4404c21..61e5a8d 100644
--- a/docker/utils/utils.py
+++ b/docker/utils/utils.py
@@ -128,7 +128,13 @@ def exclude_paths(root, patterns, dockerfile=None):
paths = get_paths(root, exclude_patterns, include_patterns,
has_exceptions=len(exceptions) > 0)
- return set(paths)
+ return set(paths).union(
+ # If the Dockerfile is in a subdirectory that is excluded, get_paths
+ # will not descend into it and the file will be skipped. This ensures
+ # it doesn't happen.
+ set([dockerfile])
+ if os.path.exists(os.path.join(root, dockerfile)) else set()
+ )
def should_include(path, exclude_patterns, include_patterns):