-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdocker.nix
executable file
·44 lines (39 loc) · 1.21 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
#!/usr/bin/env -S nix-build -o docker-image-ekklesia-notify.tar
# Run this file: ./docker.nix
# It creates a docker image archive called docker-image-ekklesia-notify.tar.
# Default tag is the git version. You can set a custom tag with:
# ./docker.nix --argstr tag mytag
# Import into docker with:
# docker load -i docker-image-ekklesia-notify.tar
{ sources ? null, tag ? null }:
with builtins;
let
serveApp = import ./nix/serve_app.nix {
inherit sources;
appConfigFile = "/settings.yml";
listenHost = "0.0.0.0";
listenPort = "8080";
};
deps = import ./nix/deps.nix { inherit sources; };
inherit (deps) pkgs;
version = import ./nix/git_version.nix { inherit pkgs; };
user = "ekklesia-notify";
passwd = pkgs.writeTextDir "etc/passwd" ''
${user}:x:10:10:${user}:/:/noshell
'';
in
pkgs.dockerTools.buildLayeredImage {
name = "ekklesia-notify";
contents = [ passwd ];
tag =
if tag == null then
trace "Automatically tagging image with version ${version}" version
else
trace "Tagging image with custom tag '${tag}'" tag;
config = {
ExposedPorts = { "8080/tcp" = {}; };
User = user;
Entrypoint = [ "${serveApp}/bin/run" ];
Cmd = [ "# runs uvicorn" ];
};
}