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

26 lines
709 B
Bash
Raw Normal View History

#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
flakeref="${1-}"
name="${2-}"
gitdir="${3:-.}"
if [ -z "$flakeref" ] || [ -z "$name" ];
then
echo "Usage: $0 FLAKEREF NAME [GITDIR]"
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 --git-dir $gitdir/.git --work-tree $gitdir rev-parse HEAD)
docker load < $image
docker tag $imagename:$imagetag git.kun.is/home/$name:$gitrev
2024-04-26 22:28:21 +00:00
docker tag $imagename:$imagetag git.kun.is/home/$name:latest
docker push git.kun.is/home/$name:$gitrev
2024-04-26 22:29:09 +00:00
docker push git.kun.is/home/$name:latest