Move env variables outsude docker build #PR2
This commit is contained in:
parent
3140b777fe
commit
6609d09e91
2 changed files with 14 additions and 11 deletions
|
@ -445,25 +445,16 @@ func (b *Builder) writeDockerfile(dir string) error {
|
||||||
// is the "ubuntu" user, since all build images
|
// is the "ubuntu" user, since all build images
|
||||||
// inherit from the ubuntu cloud ISO
|
// inherit from the ubuntu cloud ISO
|
||||||
dockerfile.WriteUser("ubuntu")
|
dockerfile.WriteUser("ubuntu")
|
||||||
dockerfile.WriteEnv("HOME", "/home/ubuntu")
|
|
||||||
dockerfile.WriteEnv("LANG", "en_US.UTF-8")
|
|
||||||
dockerfile.WriteEnv("LANGUAGE", "en_US:en")
|
|
||||||
dockerfile.WriteEnv("LOGNAME", "ubuntu")
|
dockerfile.WriteEnv("LOGNAME", "ubuntu")
|
||||||
dockerfile.WriteEnv("TERM", "xterm")
|
dockerfile.WriteEnv("HOME", "/home/ubuntu")
|
||||||
dockerfile.WriteEnv("SHELL", "/bin/bash")
|
|
||||||
dockerfile.WriteRun("sudo chown -R ubuntu:ubuntu /var/cache/drone")
|
dockerfile.WriteRun("sudo chown -R ubuntu:ubuntu /var/cache/drone")
|
||||||
dockerfile.WriteRun("sudo chown -R ubuntu:ubuntu /usr/local/bin/drone")
|
dockerfile.WriteRun("sudo chown -R ubuntu:ubuntu /usr/local/bin/drone")
|
||||||
default:
|
default:
|
||||||
// all other images are assumed to use
|
// all other images are assumed to use
|
||||||
// the root user.
|
// the root user.
|
||||||
dockerfile.WriteUser("root")
|
dockerfile.WriteUser("root")
|
||||||
dockerfile.WriteEnv("HOME", "/root")
|
|
||||||
dockerfile.WriteEnv("LANG", "en_US.UTF-8")
|
|
||||||
dockerfile.WriteEnv("LANGUAGE", "en_US:en")
|
|
||||||
dockerfile.WriteEnv("LOGNAME", "root")
|
dockerfile.WriteEnv("LOGNAME", "root")
|
||||||
dockerfile.WriteEnv("TERM", "xterm")
|
dockerfile.WriteEnv("HOME", "/root")
|
||||||
dockerfile.WriteEnv("SHELL", "/bin/bash")
|
|
||||||
dockerfile.WriteEnv("GOPATH", "/var/cache/drone")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dockerfile.WriteAdd("proxy.sh", "/etc/drone.d/")
|
dockerfile.WriteAdd("proxy.sh", "/etc/drone.d/")
|
||||||
|
@ -479,6 +470,13 @@ func (b *Builder) writeDockerfile(dir string) error {
|
||||||
func (b *Builder) writeBuildScript(dir string) error {
|
func (b *Builder) writeBuildScript(dir string) error {
|
||||||
f := buildfile.New()
|
f := buildfile.New()
|
||||||
|
|
||||||
|
// add environment variables for user env
|
||||||
|
f.WriteEnv("LANG", "en_US.UTF-8")
|
||||||
|
f.WriteEnv("LANGUAGE", "en_US:en")
|
||||||
|
f.WriteEnv("TERM", "xterm")
|
||||||
|
f.WriteEnv("GOPATH", "/var/cache/drone")
|
||||||
|
f.WriteEnv("SHELL", "/bin/bash")
|
||||||
|
|
||||||
// add environment variables about the build
|
// add environment variables about the build
|
||||||
f.WriteEnv("CI", "true")
|
f.WriteEnv("CI", "true")
|
||||||
f.WriteEnv("DRONE", "true")
|
f.WriteEnv("DRONE", "true")
|
||||||
|
|
|
@ -537,6 +537,11 @@ func TestWriteBuildScript(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
f := buildfile.New()
|
f := buildfile.New()
|
||||||
|
f.WriteEnv("LANG", "en_US.UTF-8")
|
||||||
|
f.WriteEnv("LANGUAGE", "en_US:en")
|
||||||
|
f.WriteEnv("TERM", "xterm")
|
||||||
|
f.WriteEnv("GOPATH", "/var/cache/drone")
|
||||||
|
f.WriteEnv("SHELL", "/bin/bash")
|
||||||
f.WriteEnv("CI", "true")
|
f.WriteEnv("CI", "true")
|
||||||
f.WriteEnv("DRONE", "true")
|
f.WriteEnv("DRONE", "true")
|
||||||
f.WriteEnv("DRONE_REMOTE", "git://github.com/drone/drone.git")
|
f.WriteEnv("DRONE_REMOTE", "git://github.com/drone/drone.git")
|
||||||
|
|
Loading…
Reference in a new issue