Skip to content

Commit d2cc8eb

Browse files
committed
Add support for specifying alternative dockerfile names to the parser
1 parent a7be2c5 commit d2cc8eb

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

dockerfile_parse/parser.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ def __init__(self, path=None,
8686
env_replace=True,
8787
parent_env=None,
8888
fileobj=None,
89-
build_args=None):
89+
build_args=None,
90+
dockerfile_filename=DOCKERFILE_FILENAME):
9091
"""
9192
Initialize source of Dockerfile
9293
:param path: path to (directory with) Dockerfile; if not provided,
@@ -98,6 +99,8 @@ def __init__(self, path=None,
9899
:param fileobj: seekable file-like object containing Dockerfile content
99100
as bytes (will be truncated on write)
100101
:param build_args: python dict of build args used when building image
102+
:param dockerfile_filename: name of the dockerfile to discover or create
103+
in the path (default: Dockerfile)
101104
"""
102105

103106
self.fileobj = fileobj
@@ -110,10 +113,10 @@ def __init__(self, path=None,
110113
self.fileobj.seek(0)
111114
else:
112115
path = Path(path) or Path.cwd()
113-
if path.name.endswith(DOCKERFILE_FILENAME):
116+
if path.name.endswith(dockerfile_filename):
114117
self.dockerfile = path
115118
else:
116-
self.dockerfile = path / DOCKERFILE_FILENAME
119+
self.dockerfile = path / dockerfile_filename
117120

118121
self.cache_content = cache_content
119122
self.cached_content = '' # unicode string

0 commit comments

Comments
 (0)