util

package
v0.0.0-...-724c7c4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NajsciSwrEndpoint = "https://swr-api.cn-east-293.njaci.cn/v2/manage/utils/secret"
)

Variables

View Source
var FileName string

Functions

func CopyFile

func CopyFile(srcFile, destFile string) (int64, error)

func CreateSecretAsNjaci

func CreateSecretAsNjaci() (user, pwd string)

容器镜像服务->生成临时登录指令 https://swr-api.cn-east-293.njaci.cn/v2/manage/utils/secret

func GetImageName

func GetImageName(path string) (string, error)

func GetModelArtsConfWithPlatform

func GetModelArtsConfWithPlatform(platform string) (*config.Conf, error)

func SendRequest

func SendRequest(method, url string, in io.Reader, Platform string) (*[]byte, error)

func SignClient

func SignClient(r *http.Request, Platform string) (*http.Client, error)

SignClient AK/SK签名认证

Types

type AuthInfo

type AuthInfo struct {

	// Base64加密的认证信息
	Auth string `json:"auth"`
}

func (AuthInfo) String

func (o AuthInfo) String() string

type CreateSecretResponse

type CreateSecretResponse struct {

	// 认证信息
	Auths map[string]AuthInfo `json:"auths,omitempty"`

	XSwrDockerlogin *string `json:"X-Swr-Dockerlogin,omitempty"`
	HttpStatusCode  int     `json:"-"`
}

type Docker

type Docker struct {
	*client.Client
}

1.Docker docker client

func NewDockerClient

func NewDockerClient() *Docker

2.init docker client

func (*Docker) BuildImage

func (d *Docker) BuildImage(warName, image string) error

Buildimage build image image 需要构建的镜像名称

func (*Docker) Images

func (d *Docker) Images(opt types.ImageListOptions) ([]types.ImageSummary, error)

Images get images from

func (*Docker) ImportImage

func (d *Docker) ImportImage(name, tag, path string) error

ImportImage import image

func (*Docker) LoadImage

func (d *Docker) LoadImage(path string) error

LoadImage load image from tar file

func (*Docker) PullImage

func (d *Docker) PullImage(name string) error

PullImage pull image

func (*Docker) PushImage

func (d *Docker) PushImage(image string, user, pwd, address string) error

PushImage--> pull image to harbor仓库

func (*Docker) RemoveDanglingImages

func (d *Docker) RemoveDanglingImages() error

RemoveDanglingImages remove dangling images <none>

func (*Docker) RemoveImage

func (d *Docker) RemoveImage(name string) error

RemoveImage remove image 这里需要注意的一点就是移除了镜像之后, 会出现<none>:<none>的标签,这个是因为下载的镜像是分层的,所以删除会导致

func (*Docker) SaveImage

func (d *Docker) SaveImage(ids []string, path string) error

SaveImage save image to tar file

func (*Docker) SearchImage

func (d *Docker) SearchImage(name string) ([]registry.SearchResult, error)

SearchImage search images

func (*Docker) TagImage

func (d *Docker) TagImage(source, target string) error

TagImage 打tag

type Manifest

type Manifest []struct {
	Config   string   `json:"Config"`
	RepoTags []string `json:"RepoTags"`
	Layers   []string `json:"Layers"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL