From 0861304ddc43f47299a9c04933d4b4e16adad472 Mon Sep 17 00:00:00 2001 From: Josh Dolitsky <393494+jdolitsky@users.noreply.github.com> Date: Wed, 7 Jul 2021 13:20:01 -0500 Subject: [PATCH] Remove docs, point to website (#9) Signed-off-by: Josh Dolitsky --- README.md | 69 ++++++------------------------------------------------- 1 file changed, 7 insertions(+), 62 deletions(-) diff --git a/README.md b/README.md index fe00b72b..a4d6767d 100644 --- a/README.md +++ b/README.md @@ -1,73 +1,18 @@ -# OCI Registry As Storage +# ORAS Go library :construction: **This project is currently under active development. The API may and will change incompatibly from one commit to another.** :construction: -[![GitHub Actions status](https://github.com/oras-project/oras-go/workflows/build/badge.svg)](https://github.com/oras-project/oras-go/actions?query=workflow%3Abuild) -[![Go Report Card](https://goreportcard.com/badge/github.com/oras-project/oras-go)](https://goreportcard.com/report/github.com/oras-project/oras-go) -[![GoDoc](https://godoc.org/github.com/oras-project/oras-go?status.svg)](https://godoc.org/github.com/oras-project/oras-go) +[![GitHub Actions status](https://github.com/oras-project/oras-go/workflows/build/badge.svg)](https://github.com/oras-project/oras-go/actions/workflows/build.yml?query=workflow%3Abuild) +[![Go Report Card](https://goreportcard.com/badge/oras.land/oras-go)](https://goreportcard.com/report/oras.land/oras-go) +[![GoDoc](https://godoc.org/github.com/oras.land?status.svg)](https://godoc.org/oras.land/oras-go) ![ORAS](https://github.com/oras-project/oras-www/raw/main/docs/assets/images/oras.png) -## ORAS Go Library +## Docs -Using the ORAS Go library, you can develop your own push/pull experience: `myclient push artifacts.azurecr.io/myartifact:1.0 ./mything.thang` +Documentation for the ORAS Go library is located on +the project website: [oras.land/client_libraries/go](https://oras.land/client_libraries/go/) -The package `oras.land/oras-go` can quickly be imported in other Go-based tools that -wish to benefit from the ability to store arbitrary content in container registries. - -### ORAS Go Library Example - -[Source](examples/simple_push_pull.go) - -```go -package main - -import ( - "context" - "fmt" - - "github.com/containerd/containerd/remotes/docker" - ocispec "github.com/opencontainers/image-spec/specs-go/v1" - - "oras.land/oras-go/pkg/content" - "oras.land/oras-go/pkg/oras" -) - -func check(e error) { - if e != nil { - panic(e) - } -} - -func main() { - ref := "localhost:5000/oras:test" - fileName := "hello.txt" - fileContent := []byte("Hello World!\n") - customMediaType := "my.custom.media.type" - - ctx := context.Background() - resolver := docker.NewResolver(docker.ResolverOptions{}) - - // Push file(s) w custom mediatype to registry - memoryStore := content.NewMemoryStore() - desc := memoryStore.Add(fileName, customMediaType, fileContent) - pushContents := []ocispec.Descriptor{desc} - fmt.Printf("Pushing %s to %s...\n", fileName, ref) - desc, err := oras.Push(ctx, resolver, ref, memoryStore, pushContents) - check(err) - fmt.Printf("Pushed to %s with digest %s\n", ref, desc.Digest) - - // Pull file(s) from registry and save to disk - fmt.Printf("Pulling from %s and saving to %s...\n", ref, fileName) - fileStore := content.NewFileStore("") - defer fileStore.Close() - allowedMediaTypes := []string{customMediaType} - desc, _, err = oras.Pull(ctx, resolver, ref, fileStore, oras.WithAllowedMediaTypes(allowedMediaTypes)) - check(err) - fmt.Printf("Pulled from %s with digest %s\n", ref, desc.Digest) - fmt.Printf("Try running 'cat %s'\n", fileName) -} -``` ## Code of Conduct