Code Monkey home page Code Monkey logo

space-unlimited-space's Introduction

๐Ÿ“ฆ space-unlimited-space ๐Ÿ“ฆ

This repository is a playground to demostrate how you can use Github Container Registry to store arbitrary artifacts and retrieve them without authentication.

This is the similar to the mechanism used by Brew to store and distribute artifacts.

Requirements

You will need to have skopeo installed with:

brew install skopeo

More info on skopeo here.

Publishing

1. Logging in with Github Container Registry

First, make sure you're logged in with Github Container Registry:

skopeo login ghcr.io

Username: Your Github Username Password: A Github Personal Access Token (PAT) with write:packages, read:packages and delete:packages permission. You can create it at: https://github.com/settings/tokens.

2. Uploading Image to Github Container Registry

The folder anakin in this repo contains a valid OCI Image.

You can upload the image with:

skopeo copy oci:<containername>:<tag> docker://ghcr.io/<user>/<repo>/<containername>:<tag>

Like the following:

$ skopeo copy oci:anakin:1.0.0 docker://ghcr.io/cortinico/space-unlimited-space/anakin:1.0.0
Getting image source signatures
Copying blob 57b8eee16897 done
Copying config d7a38a28d7 done
Writing manifest to image destination
Storing signatures

3. Inspect the Container Information

You can use skopeo inspect to query the available tarballs:

$ skopeo inspect docker://ghcr.io/cortinico/space-unlimited-space/anakin:1.0.0

{
    "Name": "ghcr.io/cortinico/space-unlimited-space/anakin",
    "Digest": "sha256:aa986f18e5556f9ce7ce265242ec6457ea2802030d92e5dc4c3c807a495db1e4",
    "RepoTags": [
        "1.0.0"
    ],
    "Created": null,
    "DockerVersion": "",
    "Labels": null,
    "Architecture": "amd64",
    "Os": "darwin",
    "Layers": [
        "sha256:57b8eee16897b0bb1d00190e99fb722dbaa32ecd1eb70686012ecf814ce329ba"
    ],
    "Env": null
}

Layout

The container has to follow the OCI specs:

anakin/
โ”œโ”€โ”€ blobs
โ”‚ย ย  โ””โ”€โ”€ sha256
โ”‚ย ย      โ”œโ”€โ”€ 57b8eee16897b0bb1d00190e99fb722dbaa32ecd1eb70686012ecf814ce329ba
โ”‚ย ย      โ”œโ”€โ”€ aa986f18e5556f9ce7ce265242ec6457ea2802030d92e5dc4c3c807a495db1e4
โ”‚ย ย      โ””โ”€โ”€ d7a38a28d7b1cf81b95ee50a4d011871378018ae5ee366acc5505273fee5a0b3
โ”œโ”€โ”€ index.json
โ””โ”€โ”€ oci-layout

Specifically:

  • oci-layout is immutable
  • index.json is the Image Index. Contains a reference to the Image Manifest.
  • blobs/sha256 is the folder where blobs are stores. Files should be named using their own SHA256 (or other algos).
  • 57b8eee16897b0bb1d00190e99fb722dbaa32ecd1eb70686012ecf814ce329ba is a tarball (it's a .tar.gz that contains an image)
  • aa986f18e5556f9ce7ce265242ec6457ea2802030d92e5dc4c3c807a495db1e4 is the Image Manifest contains references to the Layers (the Tarballs).
  • d7a38a28d7b1cf81b95ee50a4d011871378018ae5ee366acc5505273fee5a0b3 is the Image Config. This is immutable as we're not doing filesystem operation.

Consuming via HTTP

You can download a public tarball (a layer) from Github Container Registry with:

curl -L --verbose \
   --header "Authorization: Bearer QQ==" \
   https://ghcr.io/v2/cortinico/space-unlimited-space/anakin/blobs/sha256:57b8eee16897b0bb1d00190e99fb722dbaa32ecd1eb70686012ecf814ce329ba \
    -o output.tar.gz

Useful commands

Compute the SHA256 of all the files:

shasum -a 256 anakin/blobs/sha256/*

List filesize of all the files:

ls -la anakin/blobs/sha256/*

space-unlimited-space's People

Contributors

cortinico avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.