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:
parent
c54cbc214e
commit
6682530ea5
1 changed files with 18 additions and 0 deletions
|
@ -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
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue