login before build

This commit is contained in:
Brad Rydzewski 2015-05-15 09:56:27 -07:00
parent 78b8638d29
commit 4c14dd88a1

10
main.go
View File

@ -83,23 +83,23 @@ func main() {
} }
vargs.Repo = fmt.Sprintf("%s:%s", vargs.Repo, vargs.Tag) vargs.Repo = fmt.Sprintf("%s:%s", vargs.Repo, vargs.Tag)
// Build the container // Login to Docker
cmd := exec.Command("docker", "build", "--pull=true", "--rm=true", "-t", vargs.Repo, vargs.File) cmd := exec.Command("docker", "login", "-u", vargs.Username, "-p", vargs.Password, "-e", vargs.Email, "index.docker.io")
cmd.Dir = clone.Dir cmd.Dir = clone.Dir
cmd.Stdout = os.Stdout cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr cmd.Stderr = os.Stderr
trace(cmd)
err := cmd.Run() err := cmd.Run()
if err != nil { if err != nil {
stop() stop()
os.Exit(1) os.Exit(1)
} }
// Login to Docker // Build the container
cmd = exec.Command("docker", "login", "-u", vargs.Username, "-p", vargs.Password, "-e", vargs.Email, "index.docker.io") cmd = exec.Command("docker", "build", "--pull=true", "--rm=true", "-t", vargs.Repo, vargs.File)
cmd.Dir = clone.Dir cmd.Dir = clone.Dir
cmd.Stdout = os.Stdout cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr cmd.Stderr = os.Stderr
trace(cmd)
err = cmd.Run() err = cmd.Run()
if err != nil { if err != nil {
stop() stop()