Skip to content

Commit 6eb69bf

Browse files
committed
Add support for specifying alternative dockerfile names to the parser
Signed-off-by: Ethan Paul <ethan.paul@portalinstruments.com>
1 parent 701213e commit 6eb69bf

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

dockerfile_parse/parser.py

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

102105
self.fileobj = fileobj
@@ -109,10 +112,10 @@ def __init__(self, path=None,
109112
self.fileobj.seek(0)
110113
else:
111114
path = Path(path) or Path.cwd()
112-
if path.name.endswith(DOCKERFILE_FILENAME):
115+
if path.name.endswith(dockerfile_filename):
113116
self.dockerfile = path
114117
else:
115-
self.dockerfile = path / DOCKERFILE_FILENAME
118+
self.dockerfile = path / dockerfile_filename
116119

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

0 commit comments

Comments
 (0)