about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2024-04-20 00:20:34 +0200
committerAlan Pearce2024-04-20 00:20:34 +0200
commit3da735c4e72f8de390e5f4f0df63476cac43b6b1 (patch)
tree1641c63187b03910bd96151d649c3c2883c02513
parent98cd9b3d285219fea65961f5cf551c42adfd22e9 (diff)
downloadwebsite-3da735c4e72f8de390e5f4f0df63476cac43b6b1.tar.lz
website-3da735c4e72f8de390e5f4f0df63476cac43b6b1.tar.zst
website-3da735c4e72f8de390e5f4f0df63476cac43b6b1.zip
use long git hashes for docker tags
-rw-r--r--nix/default.nix3
-rw-r--r--nix/scripts.nix6
2 files changed, 6 insertions, 3 deletions
diff --git a/nix/default.nix b/nix/default.nix
index 2a7792a..d586e2b 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -2,13 +2,14 @@
 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" ];
diff --git a/nix/scripts.nix b/nix/scripts.nix
index 94e4d85..e48de76 100644
--- a/nix/scripts.nix
+++ b/nix/scripts.nix
@@ -43,7 +43,9 @@ with pkgs; [
   '')
   (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
   '')
 ]