Resolve env replacement for FROM command
This commit is contained in:
parent
a641ae0b10
commit
44d7266058
|
|
@ -1,4 +1,5 @@
|
||||||
FROM scratch
|
ARG image
|
||||||
|
FROM ${image}
|
||||||
# First, make sure simple arg replacement works
|
# First, make sure simple arg replacement works
|
||||||
ARG file
|
ARG file
|
||||||
COPY $file /foo
|
COPY $file /foo
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,7 @@ func TestRun(t *testing.T) {
|
||||||
"Dockerfile_test_add": {"file=context/foo"},
|
"Dockerfile_test_add": {"file=context/foo"},
|
||||||
"Dockerfile_test_onbuild": {"file=/tmp/onbuild"},
|
"Dockerfile_test_onbuild": {"file=/tmp/onbuild"},
|
||||||
"Dockerfile_test_scratch": {
|
"Dockerfile_test_scratch": {
|
||||||
|
"image=scratch",
|
||||||
"hello=hello-value",
|
"hello=hello-value",
|
||||||
"file=context/foo",
|
"file=context/foo",
|
||||||
"file3=context/b*",
|
"file3=context/b*",
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,10 @@ func DoBuild(dockerfilePath, srcContext, snapshotMode string, args []string) (na
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
for index, stage := range stages {
|
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
|
finalStage := index == len(stages)-1
|
||||||
// Unpack file system to root
|
// Unpack file system to root
|
||||||
logrus.Infof("Unpacking filesystem of %s...", baseImage)
|
logrus.Infof("Unpacking filesystem of %s...", baseImage)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue