Merge pull request #199 from priyawadhwa/from

Resolve env replacement for FROM command
This commit is contained in:
priyawadhwa
2018-06-04 15:17:38 -07:00
committed by GitHub
3 changed files with 7 additions and 2 deletions
@@ -1,4 +1,5 @@
FROM scratch
ARG image
FROM ${image}
# First, make sure simple arg replacement works
ARG file
COPY $file /foo
+1
View File
@@ -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*",
+4 -1
View File
@@ -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)