-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathdocker.nix
49 lines (43 loc) · 1.33 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
44
45
46
47
48
49
{ pkgs ? import <nixpkgs> { }, tag ? "latest" }:
let
matrix-registration-config = "/data/config.yaml";
python3 = let
packageOverrides = self: super: rec {
alembic = super.alembic.overridePythonAttrs (old: {
makeWrapperArgs = [
"--chdir '${matrix-registration}'"
''--add-flags "-x config='${matrix-registration-config}'"''
];
});
matrix-registration =
(import ./default.nix { inherit pkgs; }).overridePythonAttrs (old: {
makeWrapperArgs =
[ ''--add-flags "--config-path='${matrix-registration-config}'"'' ];
});
};
in pkgs.python3.override {
inherit packageOverrides;
# enableOptimizations = true;
# reproducibleBuild = false;
self = python3;
};
python-packages = ps: with ps; [ matrix-registration alembic ];
in pkgs.dockerTools.buildImage {
name = "matrix-registration";
tag = tag;
created = "now";
copyToRoot = python3.withPackages python-packages;
config = {
CMD = [ "matrix-registration" "serve"];
WorkingDir = "/data";
Volumes = { "/data" = { }; };
ExposedPorts = { "5000/tcp" = { }; };
HealthCheck = {
Interval = 3000000000;
Timeout = 1000000000;
StartPeriod = 3000000000;
Test =
[ "CMD" "${pkgs.curl}/bin/curl" "-fSs" "http://localhost:5000/health" ];
};
};
}