This repository has been archived on 2024-10-01. You can view files and clone it, but cannot push or open issues or pull requests.
container-images/release.sh

24 lines
640 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
flakeref="${1-}"
name="${2-}"
if [ -z "$flakeref" ] || [ -z "$name" ];
then
echo "Usage: $0 FLAKEREF NAME"
exit 1
fi
imagename=$(nix eval --no-allow-dirty --raw $flakeref.imageName)
imagetag=$(nix eval --no-allow-dirty --raw $flakeref.imageTag)
image=$(nix build --no-allow-dirty $flakeref --print-out-paths --no-link)
gitrev=$(git rev-parse HEAD)
docker load < $image
docker tag $imagename:$imagetag git.kun.is/home/$name:$gitrev
docker tag $imagename:$imagetag git.kun.is/home/$name:latest
docker push git.kun.is/home/$name:$gitrev
docker push git.kun.is/home/$name:latest