-
Notifications
You must be signed in to change notification settings - Fork 0
/
image.nix
49 lines (45 loc) · 1.19 KB
/
image.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> { }
, pkgsLinux ? import <nixpkgs> { system = "x86_64-linux"; }
}:
let
loopScript = pkgs.writeTextDir "app/loop.sh" (builtins.readFile ./loop.sh);
allScript = pkgs.writeTextDir "app/all-stats.R" (builtins.readFile ./all-stats.R);
extScript = pkgs.writeTextDir "app/external-stats.R" (builtins.readFile ./external-stats.R);
allIndex = pkgs.writeTextDir "app/all/index.html" (builtins.readFile ./index-all.html);
extIndex = pkgs.writeTextDir "app/ext/index.html" (builtins.readFile ./index-external.html);
rEnv = with pkgs; rWrapper.override {
packages = with rPackages; [
RPostgreSQL
data_table
ggplot2
jsonlite
lubridate
scales
];
};
in
pkgs.dockerTools.buildImage {
name = "marlowe-stat";
tag = "latest";
copyToRoot = pkgs.buildEnv {
name = "image-root";
pathsToLink = [ "/bin" "/app" ];
paths = [
loopScript
allScript
allIndex
extScript
extIndex
rEnv
pkgs.bash
pkgs.coreutils
pkgs.getent
pkgs.kubo
];
};
config = {
Cmd = [ "${pkgs.bash}/bin/bash" "loop.sh" ];
WorkingDir = "/app";
};
}