本文整理汇总了Golang中github.com/appc/spec/schema.RuntimeApp.Image方法的典型用法代码示例。如果您正苦于以下问题:Golang RuntimeApp.Image方法的具体用法?Golang RuntimeApp.Image怎么用?Golang RuntimeApp.Image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/appc/spec/schema.RuntimeApp
的用法示例。
在下文中一共展示了RuntimeApp.Image方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: makePod
//rktDirectory string, ociConfig string, ociRuntimeConfig string, ociDirectory string
func (this *oci2rkt) makePod() (err error) {
//1.covert to pod
this.podManifest.ACVersion = types.SemVer{
Major: 0,
Minor: 8,
Patch: 0,
PreRelease: "",
Metadata: "",
}
this.podManifest.ACKind = "PodManifest"
/*
this.podManifest.Apps = schema.AppList{
{
Name: "oci",
Image: schema.RuntimeImage{
ID: types.Hash{
Val: "",
},
},
},
}
*/
runTimeImage := schema.RuntimeImage{}
hash, err := types.NewHash("sha512-ca0bee4ecb888d10cf0816ebe7e16499230ab349bd3126976ab60b9b1db2e120")
if err != nil {
return err
}
runTimeImage.ID = *hash
runTimeApp := schema.RuntimeApp{
Name: "oci",
}
runTimeApp.Image = runTimeImage
this.podManifest.Apps = append(this.podManifest.Apps, runTimeApp)
this.podManifest.Volumes = nil
this.podManifest.Isolators = nil
this.podManifest.Annotations = nil
this.podManifest.Ports = nil
//2.marshal
podBuf, err := json.Marshal(this.podManifest)
if err != nil {
return err
}
//3.wirte pod file
pod := this.RktBundlePath + "/pod"
err = ioutil.WriteFile(pod, podBuf, 0755)
if err != nil {
return err
}
return nil
}