wip
All checks were successful
Build and push nixos-based docker container / build (push) Successful in 24s
All checks were successful
Build and push nixos-based docker container / build (push) Successful in 24s
This commit is contained in:
parent
27588a1d35
commit
3df0f3d92d
2
.github/workflows/build.yaml
vendored
2
.github/workflows/build.yaml
vendored
|
@ -20,7 +20,7 @@ jobs:
|
||||||
skopeo login --username ${{ secrets.DOCKER_USER }} --password ${{ secrets.DOCKER_PASSWORD }} "$REGISTRY"
|
skopeo login --username ${{ secrets.DOCKER_USER }} --password ${{ secrets.DOCKER_PASSWORD }} "$REGISTRY"
|
||||||
|
|
||||||
MAINTAG="sha-$(echo "$GITHUB_SHA" | cut -c 1-8)"
|
MAINTAG="sha-$(echo "$GITHUB_SHA" | cut -c 1-8)"
|
||||||
nix run .#upload-image "docker://$REGISTRY/$PACKAGE:$MAINTAG"
|
nix run --show-trace .#upload-image "docker://$REGISTRY/$PACKAGE:$MAINTAG"
|
||||||
for TAG in \
|
for TAG in \
|
||||||
"$GITHUB_REF_NAME" \
|
"$GITHUB_REF_NAME" \
|
||||||
"$GITHUB_REF_NAME-$(date +%Y%m%d-%H%M%S)" \
|
"$GITHUB_REF_NAME-$(date +%Y%m%d-%H%M%S)" \
|
||||||
|
|
57
docker.nix
57
docker.nix
|
@ -1,20 +1,63 @@
|
||||||
{ config, pkgs, ...}:
|
{ config, pkgs, lib, ...}:
|
||||||
|
|
||||||
let
|
let
|
||||||
name = "node-red";
|
name = "node-red";
|
||||||
|
packages =
|
||||||
|
with pkgs;
|
||||||
|
[
|
||||||
|
nodejs
|
||||||
|
nodePackages.npm
|
||||||
|
nodePackages.node-red
|
||||||
|
#ungoogled-chromium
|
||||||
|
];
|
||||||
entrypoint = pkgs.writeShellApplication {
|
entrypoint = pkgs.writeShellApplication {
|
||||||
name = "entrypoint";
|
name = "entrypoint";
|
||||||
|
|
||||||
runtimeInputs = with pkgs; with nodePackages; [
|
runtimeInputs = packages;
|
||||||
node-red
|
|
||||||
#ungoogled-chromium
|
|
||||||
];
|
|
||||||
|
|
||||||
text = ''
|
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 {
|
in pkgs.dockerTools.streamLayeredImage {
|
||||||
inherit name;
|
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.Cmd = [ "${entrypoint}/bin/entrypoint" ];
|
||||||
|
config.WorkingDir = "/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
|
||||||
|
date > build-date.txt
|
||||||
|
cd data
|
||||||
|
npm i node-red
|
||||||
|
npm i passport-openidconnect
|
||||||
|
cd ..
|
||||||
|
chown -R node-red:node-red data
|
||||||
|
chmod -R 750 data
|
||||||
|
'';
|
||||||
|
extraCommands = ''
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user