Skip to content

Commit

Permalink
fix(v1): add base env and runtime env to both dev&nondev (#1538)
Browse files Browse the repository at this point in the history
Signed-off-by: Keming <kemingyang@tensorchord.ai>
  • Loading branch information
kemingy committed Mar 24, 2023
1 parent 176637b commit 9a4cad6
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions pkg/lang/ir/v1/system.go
Expand Up @@ -277,13 +277,6 @@ func (g *generalGraph) compileLanguagePackages(root llb.State) llb.State {
}

func (g *generalGraph) compileDevPackages(root llb.State) llb.State {
for _, env := range types.BaseEnvironment {
root = root.AddEnv(env.Name, env.Value)
}
for k, v := range g.RuntimeEnviron {
root = root.AddEnv(k, v)
}

// apt packages
var sb strings.Builder
sb.WriteString("apt-get update && apt-get install -y apt-utils && ")
Expand Down Expand Up @@ -341,6 +334,15 @@ func (g *generalGraph) compileBaseImage() (llb.State, error) {
kv := strings.SplitN(e, "=", 2)
g.RuntimeEnviron[kv[0]] = kv[1]
}

// add necessary envs
for _, env := range types.BaseEnvironment {
base = base.AddEnv(env.Name, env.Value)
}
for k, v := range g.RuntimeEnviron {
base = base.AddEnv(k, v)
}

// TODO: inherit the USER from base
g.User = ""
return base, nil
Expand Down

0 comments on commit 9a4cad6

Please sign in to comment.