func Push(sous *core.Sous, args []string) { target := "app" if len(args) != 0 { target = args[0] } core.RequireGit() core.RequireDocker() if err := git.AssertCleanWorkingTree(); err != nil { cli.Warn("Dirty working tree: %s", err) } _, context := sous.AssembleTargetContext(target) tag := context.DockerTag() if !docker.ImageExists(tag) { cli.Fatalf("No built image available; try building first") } docker.Push(tag) name := context.CanonicalPackageName() cli.Successf("Successfully pushed %s v%s as %s", name, context.BuildVersion, context.DockerTag()) }
// LastBuildImageExists checks that the previously build image, if any, still // exists on this machine. If there is no previously built image, or it's been // deleted, return false, otherwise true. func (c *Context) LastBuildImageExists() bool { return docker.ImageExists(c.PrevDockerTag()) }