-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker.nix
More file actions
56 lines (51 loc) · 1.53 KB
/
docker.nix
File metadata and controls
56 lines (51 loc) · 1.53 KB
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
50
51
52
53
54
55
56
with import <nixpkgs> { };
with lib;
let
flattenSetSep = sep: set:
listToAttrs (collect (x: x ? name) (mapAttrsRecursive
(p: v: attrsets.nameValuePair (builtins.concatStringsSep sep p) v) set));
flattenSet = set: flattenSetSep "." set;
ipmi = callPackage ./default.nix {};
in pkgs.dockerTools.buildLayeredImage rec {
name = "docker-registry.intr/utils/nix-ipmi";
tag = "latest";
contents = [
bashInteractive coreutils fontconfig.out shared_mime_info
];
config = {
Entrypoint = [ "${ipmi}/bin/ipmi" ];
Env = [
"TZ=Europe/Moscow"
"TZDIR=${tzdata}/share/zoneinfo"
"LOCALE_ARCHIVE_2_27=${locale}/lib/locale/locale-archive"
"LOCALE_ARCHIVE=${locale}/lib/locale/locale-archive"
"LC_ALL=en_US.UTF-8"
];
Labels = flattenSet rec {
ru.majordomo.docker.cmd =
builtins.concatStringsSep " " [
"xhost" "+local:;"
"docker" "run" "--rm" "--network=host" "--tty" "--interactive"
"--user" "1000:997" "--env" "DISPLAY=$DISPLAY"
"--volume" "/etc/localtime:/etc/localtime:ro"
"--volume" "/tmp/.X11-unix:/tmp/.X11-unix"
"${name}:master" "jenkins.ipmi" "IPMI_PASSWORD"
];
};
};
extraCommands = ''
set -x -e
mkdir -p {etc,home/alice,root,tmp}
chmod 755 etc
chmod 777 home/alice
chmod 1777 tmp
cat > etc/passwd << 'EOF'
root:!:0:0:System administrator:/root:/bin/sh
alice:!:1000:997:Alice:/home/alice:/bin/sh
EOF
cat > etc/group << 'EOF'
root:!:0:
users:!:997:
EOF
'';
}