Skip to content

Commit

Permalink
Merge pull request #199 from priyawadhwa/from
Browse files Browse the repository at this point in the history
Resolve env replacement for FROM command
  • Loading branch information
priyawadhwa authored Jun 4, 2018
2 parents a641ae0 + 44d7266 commit 732a286
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion integration/dockerfiles/Dockerfile_test_scratch
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM scratch
ARG image
FROM ${image}
# First, make sure simple arg replacement works
ARG file
COPY $file /foo
Expand Down
1 change: 1 addition & 0 deletions integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ func TestRun(t *testing.T) {
"Dockerfile_test_add": {"file=context/foo"},
"Dockerfile_test_onbuild": {"file=/tmp/onbuild"},
"Dockerfile_test_scratch": {
"image=scratch",
"hello=hello-value",
"file=context/foo",
"file3=context/b*",
Expand Down
5 changes: 4 additions & 1 deletion pkg/executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ func DoBuild(dockerfilePath, srcContext, snapshotMode string, args []string) (na
return nil, nil, err
}
for index, stage := range stages {
baseImage := stage.BaseName
baseImage, err := util.ResolveEnvironmentReplacement(stage.BaseName, args, false)
if err != nil {
return nil, nil, err
}
finalStage := index == len(stages)-1
// Unpack file system to root
logrus.Infof("Unpacking filesystem of %s...", baseImage)
Expand Down

0 comments on commit 732a286

Please sign in to comment.