This commit is contained in:
parent
27588a1d35
commit
fea1e8d45a
43
docker.nix
43
docker.nix
|
@ -2,19 +2,52 @@
|
|||
|
||||
let
|
||||
name = "node-red";
|
||||
packages =
|
||||
with pkgs;
|
||||
with nodePackages;
|
||||
with dockerTools;
|
||||
[
|
||||
bash
|
||||
coreutils
|
||||
nodejs
|
||||
npm
|
||||
node-red
|
||||
usrBinEnv
|
||||
binSh
|
||||
caCertificates
|
||||
fakeNss
|
||||
#ungoogled-chromium
|
||||
];
|
||||
entrypoint = pkgs.writeShellApplication {
|
||||
name = "entrypoint";
|
||||
|
||||
runtimeInputs = with pkgs; with nodePackages; [
|
||||
node-red
|
||||
#ungoogled-chromium
|
||||
];
|
||||
runtimeInputs = packages;
|
||||
|
||||
text = ''
|
||||
node-red -u "''${DATA-/data}" -s "''${SETTINGS-/data/settings.js}"
|
||||
DATA="''${DATA-/data}"
|
||||
cd "$DATA"
|
||||
node-red -u "$DATA" -s "''${SETTINGS-/data/settings.js}"
|
||||
'';
|
||||
};
|
||||
in pkgs.dockerTools.streamLayeredImage {
|
||||
inherit name;
|
||||
contents = packages;
|
||||
config.Cmd = [ "${entrypoint}/bin/entrypoint" ];
|
||||
config.Workdir = "/data";
|
||||
config.Env = [ "HOME=/data" ];
|
||||
|
||||
fakeRootCommands = ''
|
||||
mkdir -p /tmp
|
||||
chmod 1777 /tmp
|
||||
mkdir -p /data
|
||||
${pkgs.dockerTools.shadowSetup}
|
||||
groupadd -r node-red
|
||||
useradd -r -g node-red node-red
|
||||
mkdir -p /data
|
||||
chown -R node-red:node-red /data
|
||||
chmod -R 750 /data
|
||||
'';
|
||||
extraCommands = ''
|
||||
find / > files-that-existed-at-extraCommands-time.txt
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user