Skip to content

Commit 381d6c7

Browse files
Added ability to specify Docker build stage (fixes #329) (#330)
* added build_stage to BuildInstructions * extract build stage * specify build stage * updated version * updated docs * bug fix: stage -> target
1 parent 68664f1 commit 381d6c7

File tree

6 files changed

+18
-1
lines changed

6 files changed

+18
-1
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 2.1.27 (2019-05-08)
2+
3+
### Features
4+
5+
* Added ability to specify a particular Docker build stage.
6+
7+
18
## 2.1.26 (2019-03-14)
29

310
### Bug Fixes

bugzoo/core/build.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ class BuildInstructions(object):
5353
"""
5454
depends_on = attr.ib(type=Optional[str])
5555

56+
"""
57+
The name of the build stage, if any, that should be used when building this
58+
image.
59+
"""
60+
build_stage = attr.ib(type=Optional[str], default=None)
61+
5662
@property
5763
def name(self) -> str:
5864
return self.tag

bugzoo/mgr/build.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def build(self,
114114
tag=name,
115115
# pull=force,
116116
buildargs=instructions.arguments,
117+
target=instructions.build_stage,
117118
decode=True,
118119
rm=True)
119120

bugzoo/mgr/source.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ def __parse_blueprint(self, source: Source, fn: str, d: dict) -> BuildInstructio
165165
filename=d.get('file', 'Dockerfile'),
166166
arguments=d.get('arguments', {}),
167167
source=source.name,
168+
build_stage=d.get('build-stage', None),
168169
depends_on=d.get('depends-on', None))
169170

170171
def __parse_bug(self, source: Source, fn: str, d: dict) -> Bug:

bugzoo/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.1.26'
1+
__version__ = '2.1.27'

docs/file-format.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ Below, we discuss each of the properties used to describe a blueprint:
6868
image.
6969
* The :code:`depends-on` property optionally specifies the name of the Docker
7070
image, if any, that the Docker image described by the blueprint relies on.
71+
* The :code:`build-stage` property optionally specifies the name of the Docker
72+
build stage that should be used to construct the image.
7173

7274
Bugs
7375
----

0 commit comments

Comments
 (0)