本文整理匯總了Golang中github.com/opentable/sous/core.Context.DockerTag方法的典型用法代碼示例。如果您正苦於以下問題:Golang Context.DockerTag方法的具體用法?Golang Context.DockerTag怎麽用?Golang Context.DockerTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/opentable/sous/core.Context
的用法示例。
在下文中一共展示了Context.DockerTag方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: DockerRun
func (t *AppTarget) DockerRun(c *core.Context) *docker.Run {
dr := docker.NewRun(c.DockerTag())
port0, err := ports.GetFreePort()
if err != nil {
cli.Fatalf("Unable to get free port: %s", err)
}
dr.AddEnv("PORT0", strconv.Itoa(port0))
dr.AddEnv("TASK_HOST", core.DivineTaskHost())
return dr
}
示例2: DockerRun
// DockerRun returns a configured *docker.Run, which is used to create a new
// container when the old one is stale or does not exist.
func (t *CompileTarget) DockerRun(c *core.Context) *docker.Run {
containerName := t.ContainerName(c)
run := docker.NewRun(c.DockerTag())
run.Name = containerName
run.AddEnv("ARTIFACT_NAME", t.artifactName(c))
uid := cmd.Stdout("id", "-u")
gid := cmd.Stdout("id", "-g")
artifactOwner := fmt.Sprintf("%s:%s", uid, gid)
run.AddEnv("ARTIFACT_OWNER", artifactOwner)
artDir := t.artifactDir(c)
dir.EnsureExists(artDir)
run.AddVolume(artDir, "/artifacts")
run.AddVolume(c.WorkDir, "/wd")
run.Command = "npm install"
return run
}
示例3: DockerRun
func (t *TestTarget) DockerRun(c *core.Context) *docker.Run {
containerName := t.ContainerName(c)
run := docker.NewRun(c.DockerTag())
run.Name = containerName
//run.AddEnv("ARTIFACT_NAME", t.artifactName(c))
uid := cmd.Stdout("id", "-u")
gid := cmd.Stdout("id", "-g")
artifactOwner := fmt.Sprintf("%s:%s", uid, gid)
run.AddEnv("ARTIFACT_OWNER", artifactOwner)
artDir := t.artifactDir(c)
dir.EnsureExists(artDir)
run.AddVolume(artDir, "/artifacts")
run.AddVolume(c.WorkDir, "/wd")
run.Command = fmt.Sprintf("go generate && { [ -d Godeps ] && godep go test ./... || go test ./...; }")
return run
}