mirror of
https://github.com/input-output-hk/devx.git
synced 2024-09-21 09:07:45 +03:00
4e8dc4896a
--------- Co-authored-by: Yvan Sraka <yvan@sraka.xyz> Co-authored-by: Moritz Angermann <moritz.angermann@gmail.com> Co-authored-by: Andrea Bedini <andrea.bedini@tweag.io>
19 lines
608 B
Bash
Executable File
19 lines
608 B
Bash
Executable File
#!/bin/bash
|
|
|
|
TOKEN=$(curl --silent https://ghcr.io/token\?scope\=repository:$1:pull | jq -r .token)
|
|
|
|
BLOB=$(curl \
|
|
--silent \
|
|
--request 'GET' \
|
|
--header "Authorization: Bearer $TOKEN" \
|
|
--header "Accept: application/vnd.docker.distribution.manifest.list.v2+json" \
|
|
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
|
|
--header "Accept: application/vnd.oci.image.manifest.v1+json" \
|
|
"https://ghcr.io/v2/$1/manifests/$2" | tee manifest.json | jq -r '.layers[0].digest')
|
|
|
|
curl \
|
|
--location \
|
|
--request GET \
|
|
--header "Authorization: Bearer ${TOKEN}" \
|
|
"https://ghcr.io/v2/$1/blobs/${BLOB}"
|