1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2025-09-05 18:41:00 +00:00

feat: add commit timestamp to oci-image

This commit is contained in:
Samuel Meenzen 2025-07-16 17:16:52 +02:00
parent c54cbc214e
commit 6682530ea5
No known key found for this signature in database

View file

@ -1,6 +1,7 @@
# Keep sorted
{ default
, dockerTools
, inputs
, lib
, pkgs
}:
@ -13,10 +14,27 @@ let
})
];
};
# This is a unix timestamp of the last commit
timestamp = inputs.self.lastModified;
# Convert the timestamp to an ISO 8601 string
iso = builtins.readFile (
pkgs.runCommand "timestamp" {
when = timestamp;
nativeBuildInputs = [ pkgs.coreutils ];
} ''
date -u -d "@$when" +%Y-%m-%dT%H:%M:%SZ > $out
''
);
# Remove trailing newline
isoTrimmed = lib.strings.trim iso;
in
dockerTools.buildImage {
name = default.pname;
tag = "next";
created = isoTrimmed;
copyToRoot = [
dockerTools.caCertificates
];