Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
55 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,74 @@ | ||
{ inputs }: | ||
let | ||
inherit (inputs) std self nixpkgs; | ||
inherit (nixpkgs.lib) removePrefix mapAttrsToList; | ||
inherit (nixpkgs.lib) removePrefix mapAttrsToList mapAttrs; | ||
inherit (nixpkgs.lib.strings) concatMapStrings; | ||
inherit (self) operables; | ||
inherit (self.sourceInfo) lastModifiedDate; | ||
|
||
mkImage = name: | ||
let | ||
tagName = removePrefix "marlowe-" name; | ||
tagDate = builtins.substring 0 8 lastModifiedDate; # pull out just date | ||
in | ||
mkImage = { operable, description, name ? operable }: tag: | ||
std.lib.ops.mkStandardOCI { | ||
name = "iohkbuild/marlowe"; | ||
tag = "${tagName}-${tagDate}"; | ||
operable = operables.${name}; | ||
inherit tag; | ||
name = "ghcr.io/input-output-hk/${name}"; | ||
operable = operables.${operable}; | ||
uid = "0"; | ||
gid = "0"; | ||
labels = { | ||
inherit description; | ||
source = "https://github.com/input-output-hk/marlowe-cardano"; | ||
license = "Apache-2.0"; | ||
}; | ||
}; | ||
|
||
images = { | ||
chain-indexer = mkImage "chain-indexer"; | ||
marlowe-chain-sync = mkImage "marlowe-chain-sync"; | ||
marlowe-indexer = mkImage "marlowe-indexer"; | ||
marlowe-sync = mkImage "marlowe-sync"; | ||
marlowe-tx = mkImage "marlowe-tx"; | ||
marlowe-proxy = mkImage "marlowe-proxy"; | ||
marlowe-web-server = mkImage "marlowe-web-server"; | ||
chain-indexer = mkImage { | ||
operable = "chain-indexer"; | ||
name = "marlowe-chain-indexer"; | ||
description = "A Cardano chain indexer for the Marlowe Runtime"; | ||
}; | ||
marlowe-chain-sync = mkImage { | ||
operable = "marlowe-chain-sync"; | ||
description = "A Cardano chain sync and query service for the Marlowe Runtime."; | ||
}; | ||
marlowe-indexer = mkImage { | ||
operable = "marlowe-indexer"; | ||
description = "A Marlowe contract indexing service for the Marlowe Runtime."; | ||
}; | ||
marlowe-sync = mkImage { | ||
operable = "marlowe-sync"; | ||
description = "A Marlowe contract synchronization and query service for the Marlowe Runtime."; | ||
}; | ||
marlowe-tx = mkImage { | ||
operable = "marlowe-tx"; | ||
description = "A Marlowe transaction creation service for the Marlowe Runtime."; | ||
}; | ||
marlowe-proxy = mkImage { | ||
operable = "marlowe-proxy"; | ||
description = "An API Gateway service for the Marlowe Runtime."; | ||
}; | ||
marlowe-web-server = mkImage { | ||
operable = "marlowe-web-server"; | ||
description = "An HTTP server for the Marlowe Runtime, exposing a REST API."; | ||
}; | ||
}; | ||
|
||
forAllImages = f: concatMapStrings (s: s + "\n") (mapAttrsToList (_: f) images); | ||
in | ||
images // { | ||
forAllImages = f: tag: concatMapStrings | ||
(s: s + "\n") | ||
(mapAttrsToList (_: img: f (img tag)) images); | ||
|
||
all = { | ||
copyToDockerDaemon = std.lib.ops.writeScript { | ||
name = "copy-to-docker-daemon"; | ||
text = forAllImages (img: "${img.copyToDockerDaemon}/bin/copy-to-docker-daemon"); | ||
}; | ||
copyToRegistry = std.lib.ops.writeScript { | ||
name = "copy-to-registry"; | ||
text = forAllImages (img: "${img.copyToRegistry}/bin/copy-to-registry"); | ||
mkImages = tag: (mapAttrs (_: img: img tag) images) // { | ||
all = { | ||
copyToDockerDaemon = std.lib.ops.writeScript { | ||
name = "copy-to-docker-daemon"; | ||
text = forAllImages (img: "${img.copyToDockerDaemon}/bin/copy-to-docker-daemon") tag; | ||
}; | ||
copyToRegistry = std.lib.ops.writeScript { | ||
name = "copy-to-registry"; | ||
text = forAllImages (img: "${img.copyToRegistry}/bin/copy-to-registry") tag; | ||
}; | ||
}; | ||
}; | ||
in | ||
{ | ||
latest = mkImages "latest"; | ||
} |