-
Notifications
You must be signed in to change notification settings - Fork 48
/
default.nix
48 lines (43 loc) · 984 Bytes
/
default.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
{ pkgs ? import <nixpkgs> { }, ... }:
with pkgs; let
shell = import ./shell.nix {
isDevelopment = false;
};
python-venv = pkgs.buildEnv {
name = "python-venv";
paths = [
(pkgs.runCommand "python-venv" { } ''
mkdir -p $out/lib
cp -r "${./.venv/lib/python3.13/site-packages}"/* $out/lib
'')
];
};
in
with pkgs; dockerTools.buildLayeredImage {
name = "docker.io/zaczero/cbbi";
tag = "latest";
maxLayers = 10;
contents = shell.buildInputs ++ [ python-venv ];
extraCommands = ''
set -e
mkdir app && cd app
cp "${./.}"/LICENSE .
cp "${./.}"/*.py .
mkdir api metrics
cp "${./api}"/*.py api
cp "${./metrics}"/*.py metrics
'';
config = {
WorkingDir = "/app";
Env = [
"PYTHONPATH=${python-venv}/lib"
"PYTHONUNBUFFERED=1"
"PYTHONDONTWRITEBYTECODE=1"
];
Volumes = {
"/app/output" = { };
};
Entrypoint = [ "python" "main.py" ];
Cmd = [ ];
};
}