Simplify `State` setup

On this code `dispatchEnv` is called with `commit = false`,
so this call do these 2 things

* `AddEnv` to `d.state`
* `addEnv` to update `d.image.Config.Env`

But updating `d.image.Config.Env` has no effect on `d.image.Config.Env`
because this is in for-loop of `range d.image.Config.Env`.

Signed-off-by: Yuichiro Kaneko <spiketeika@gmail.com>
docker-18.09
Yuichiro Kaneko 2018-07-18 21:29:55 +09:00
parent 198465299c
commit 5838f9e763
1 changed files with 1 additions and 3 deletions

View File

@ -252,9 +252,7 @@ func Dockerfile2LLB(ctx context.Context, dt []byte, opt ConvertOpt) (*llb.State,
if len(parts) > 1 {
v = parts[1]
}
if err := dispatchEnv(d, &instructions.EnvCommand{Env: []instructions.KeyValuePair{{Key: parts[0], Value: v}}}, false); err != nil {
return nil, nil, err
}
d.state = d.state.AddEnv(parts[0], v)
}
if d.image.Config.WorkingDir != "" {
if err = dispatchWorkdir(d, &instructions.WorkdirCommand{Path: d.image.Config.WorkingDir}, false); err != nil {