Skip to content

Commit

Permalink
Added ability to specify Docker build stage (fixes #329) (#330)
Browse files Browse the repository at this point in the history
* added build_stage to BuildInstructions

* extract build stage

* specify build stage

* updated version

* updated docs

* bug fix: stage -> target
  • Loading branch information
ChrisTimperley authored May 8, 2019
1 parent 68664f1 commit 381d6c7
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 2.1.27 (2019-05-08)

### Features

* Added ability to specify a particular Docker build stage.


## 2.1.26 (2019-03-14)

### Bug Fixes
Expand Down
6 changes: 6 additions & 0 deletions bugzoo/core/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ class BuildInstructions(object):
"""
depends_on = attr.ib(type=Optional[str])

"""
The name of the build stage, if any, that should be used when building this
image.
"""
build_stage = attr.ib(type=Optional[str], default=None)

@property
def name(self) -> str:
return self.tag
Expand Down
1 change: 1 addition & 0 deletions bugzoo/mgr/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def build(self,
tag=name,
# pull=force,
buildargs=instructions.arguments,
target=instructions.build_stage,
decode=True,
rm=True)

Expand Down
1 change: 1 addition & 0 deletions bugzoo/mgr/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def __parse_blueprint(self, source: Source, fn: str, d: dict) -> BuildInstructio
filename=d.get('file', 'Dockerfile'),
arguments=d.get('arguments', {}),
source=source.name,
build_stage=d.get('build-stage', None),
depends_on=d.get('depends-on', None))

def __parse_bug(self, source: Source, fn: str, d: dict) -> Bug:
Expand Down
2 changes: 1 addition & 1 deletion bugzoo/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.1.26'
__version__ = '2.1.27'
2 changes: 2 additions & 0 deletions docs/file-format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ Below, we discuss each of the properties used to describe a blueprint:
image.
* The :code:`depends-on` property optionally specifies the name of the Docker
image, if any, that the Docker image described by the blueprint relies on.
* The :code:`build-stage` property optionally specifies the name of the Docker
build stage that should be used to construct the image.

Bugs
----
Expand Down

0 comments on commit 381d6c7

Please sign in to comment.