本文整理汇总了Golang中github.com/opentable/sous/core.Context.TemporaryLinkResource方法的典型用法代码示例。如果您正苦于以下问题:Golang Context.TemporaryLinkResource方法的具体用法?Golang Context.TemporaryLinkResource怎么用?Golang Context.TemporaryLinkResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/opentable/sous/core.Context
的用法示例。
在下文中一共展示了Context.TemporaryLinkResource方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Dockerfile
func (t *TestTarget) Dockerfile(c *core.Context) *docker.Dockerfile {
df := &docker.Dockerfile{}
df.From = t.pack.baseImageTag("test")
c.TemporaryLinkResource("build-prep.bash")
buildPrepContainerPath := "/build-prep.bash"
df.AddAdd("build-prep.bash", buildPrepContainerPath)
df.AddRun(fmt.Sprintf("chmod +x %s", buildPrepContainerPath))
uid := cmd.Stdout("id", "-u")
gid := cmd.Stdout("id", "-g")
username := cmd.Stdout("whoami")
// Just use the username for group name, it doesn't matter as long as
// the IDs are right.
groupAdd := fmt.Sprintf("groupadd -g %s %s", gid, username)
// Explanation of some of the below useradd flags:
// -M means do not create home directory, which we do not need
// --no-log-init means do not create a 32G sparse file (which Docker commit
// cannot handle properly, and tries to create a non-sparse 32G file.)
userAdd := fmt.Sprintf("useradd --no-log-init -M --uid %s --gid %s %s", uid, gid, username)
df.AddRun(fmt.Sprintf("%s && %s", groupAdd, userAdd))
df.Entrypoint = []string{"/build-prep.bash"}
return df
}