forked from input-output-hk/cardano-sl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker.nix
43 lines (41 loc) · 1.16 KB
/
docker.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{ environment ? "mainnet"
, connect
, gitrev
, pkgs
, connectArgs ? {}
}:
with pkgs.lib;
let
connectToCluster = connect ({
inherit gitrev environment;
stateDir = "/wallet/${environment}";
walletListen = "0.0.0.0:8090";
walletDocListen = "0.0.0.0:8091";
ekgListen = "0.0.0.0:8000";
} // connectArgs);
startScript = pkgs.writeScriptBin "cardano-start" ''
#!/bin/sh
set -e
set -o pipefail
export LOCALE_ARCHIVE="${pkgs.glibcLocales}/lib/locale/locale-archive"
if [ ! -d /wallet ]; then
echo '/wallet volume not mounted, you need to create one with `docker volume create` and pass the correct -v flag to `docker run`'
exit 1
fi
cd /wallet
exec ${connectToCluster}
'';
in pkgs.dockerTools.buildImage {
name = "cardano-container-${environment}";
contents = with pkgs; [ iana-etc startScript openssl bashInteractive coreutils utillinux iproute iputils curl socat ];
config = {
Cmd = [ "cardano-start" ];
ExposedPorts = {
"3000/tcp" = {}; # protocol
"8090/tcp" = {}; # wallet
"8091/tcp" = {}; # wallet doc
"8100/tcp" = {}; # explorer api
"8000/tcp" = {}; # ekg
};
};
}