--- a/ChangeLog Wed Nov 15 11:33:59 2017 -0600
+++ b/ChangeLog Wed Nov 22 11:48:51 2017 -0600
@@ -2,6 +2,7 @@
* Changed TaskTimeout to PlanTimeout. Fixed # 134
* Added --list-environment to show the config and builtin environment variables. Fixed #132
* Added a user option to the Docker run task. PR #38 (Eric Fritz)
+ * Added a target option to the Docker build task. To specify which stage to use in a multi stage Dockerfile. * Fix a regression in the environment mapper that could mess up script attributes. PR #37 (Eric Fritz)
--- a/REFERENCE.md Wed Nov 15 11:33:59 2017 -0600
+++ b/REFERENCE.md Wed Nov 22 11:48:51 2017 -0600
@@ -220,6 +220,7 @@
| labels | | | A list of labels to set on the image being built |
| tag | | | The tag to apply to the image |
| tags | | | The list of tags as described above |
+| target | | | The name of the target to build in a multi stage dockerfile | At least one tag must be supplied by either the `tag` or `tags` attribute. If both are
supplied, `tag` is inserted to the front of `tags`.
--- a/docker/build.go Wed Nov 15 11:33:59 2017 -0600
+++ b/docker/build.go Wed Nov 22 11:48:51 2017 -0600
@@ -35,6 +35,7 @@
Files yaml.StringOrSlice `yaml:"files"`
Tags yaml.StringOrSlice `yaml:"tags"`
+ Target string `yaml:"target"` Labels yaml.StringOrSlice `yaml:"labels"`
Arguments yaml.StringOrSlice `yaml:"arguments"`
@@ -44,6 +45,7 @@
{{range .Tags}} -t {{.}}{{end}}
{{range .Labels}} --label '{{.}}'{{end}}
{{range .Arguments}} --build-arg {{.}}{{end}}
+{{if .Target}} --target {{.Target}}{{end}} func (b *Build) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error {
@@ -112,6 +114,7 @@
"dockerfile": filepath.Join(tmpDir, filepath.Base(dockerfile)),
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/multi-stage/Dockerfile Wed Nov 22 11:48:51 2017 -0600
@@ -0,0 +1,13 @@
+FROM alpine:edge as multi-stage-base +# create our first child +FROM multi-stage-base as multi-stage-left +# create our second child +FROM multi-stage-base as multi-stage-right --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/multi-stage/convey.yml Wed Nov 22 11:48:51 2017 -0600
@@ -0,0 +1,41 @@
+ target: multi-stage-left + target: multi-stage-right + tags: multi-stage-right + image: multi-stage-left + image: multi-stage-right