Files
docker-nixpkgs/push-all
zimbatm 8aababdd97 ci: switch images from Docker Hub to GitHub Packages
Docker changed their mind and are asking us to pay to keep the org on
Docker Hub.
2023-03-16 12:18:40 +01:00

23 lines
569 B
Bash
Executable File

#!/usr/bin/env bash
#
# Usage: ./push-all <registry> <image-prefix> <image-tag>
set -euo pipefail
registry=${1:-ghcr.io}
image_prefix=${2:-nixpkgs}
image_tag=${3:-latest}
releases_json=$(nix-instantiate --strict --eval --json)
echo "=== Pushing images to $registry"
for attr in $(echo "$releases_json" | jq -r "keys[]") ; do
file=$(echo "$releases_json" | jq -r ".\"$attr\"")
src=docker-archive://$file
dst=docker://$registry/$image_prefix/$attr:$image_tag
echo "--- attr=$attr src=$src dst=$dst"
skopeo copy --insecure-policy "$src" "$dst"
done
echo OK