This commit is contained in:
parent
27588a1d35
commit
397c9de321
53
docker.nix
53
docker.nix
|
@ -1,20 +1,59 @@
|
|||
{ config, pkgs, ...}:
|
||||
|
||||
{ config, pkgs, lib, ...}:
|
||||
let
|
||||
name = "node-red";
|
||||
packages =
|
||||
with pkgs;
|
||||
[
|
||||
nodejs
|
||||
nodePackages.npm
|
||||
nodePackages.node-red
|
||||
#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 = pkgs.buildEnv {
|
||||
name = "imgroot";
|
||||
paths = (with pkgs; [
|
||||
shadow
|
||||
less
|
||||
bashInteractive
|
||||
coreutils
|
||||
findutils
|
||||
dockerTools.usrBinEnv
|
||||
dockerTools.binSh
|
||||
dockerTools.caCertificates
|
||||
dockerTools.fakeNss
|
||||
] + packages);
|
||||
};
|
||||
config.Cmd = [ "${entrypoint}/bin/entrypoint" ];
|
||||
config.Workdir = "/data";
|
||||
config.Env = with pkgs; [ "HOME=/data" ];
|
||||
|
||||
enableFakechroot = true;
|
||||
fakeRootCommands = ''
|
||||
# ${pkgs.runtimeShell}
|
||||
mkdir -p tmp
|
||||
chmod 1777 tmp
|
||||
${pkgs.dockerTools.shadowSetup}
|
||||
groupadd -r node-red
|
||||
useradd -r -g node-red node-red
|
||||
id node-red 2>&1 > node-red.id
|
||||
mkdir -p data
|
||||
chown -R node-red:node-red data
|
||||
chmod -R 750 data
|
||||
date > build-date.txt
|
||||
'';
|
||||
extraCommands = ''
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user