use long git hashes for docker tags
Alan Pearce alan@alanpearce.eu
Sat, 20 Apr 2024 00:20:34 +0200
2 files changed, 6 insertions(+), 3 deletions(-)
M nix/default.nix → nix/default.nix
@@ -2,13 +2,14 @@ { pkgs, self }: let revision = "${self.lastModifiedDate}-${self.shortRev or self.dirtyShortRev or "dirty"}"; version = self.shortRev or self.dirtyShortRev or "unstable-${self.lastModified}"; + dockerTag = self.rev or self.dirtyRev or "unstable-${self.lastModified}"; mkDocker = server: let PORT = 3000; in pkgs.dockerTools.streamLayeredImage { name = "registry.fly.io/alanpearce-eu"; - tag = revision; + tag = dockerTag; contents = [ server ]; config = { Cmd = [ "website" ];
M nix/scripts.nix → nix/scripts.nix
@@ -43,7 +43,9 @@ stream-fly | ${gzip}/bin/gzip --fast | ${skopeo}/bin/skopeo copy docker-archive:/dev/stdin "$@" '') (writeShellScriptBin "deploy" '' set -eu - push-to-registry docker://${image} - ${pkgs.flyctl}/bin/flyctl deploy + TAG=$(git rev-parse HEAD) + IMAGE=${image}:$TAG + push-to-registry docker://$IMAGE + ${pkgs.flyctl}/bin/flyctl deploy --image $IMAGE '') ]