25 lines
709 B
Bash
Executable file
25 lines
709 B
Bash
Executable file
#!/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
|
|
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
|