Builder is working, kinda
Build images / Build (bitwarden) (push) Failing after 1s
Build images / Build (builder) (push) Failing after 1s
Build images / Build (immich) (push) Failing after 1s
Build images / Build (sword-container-builder) (push) Failing after 1s
buildbot/nix-eval Build done.
buildbot/nix-build Build done.
buildbot/nix-effects Build done.
Build images / Build (vm-test) (push) Failing after 1s
Build images / Build (bitwarden) (push) Failing after 1s
Build images / Build (builder) (push) Failing after 1s
Build images / Build (immich) (push) Failing after 1s
Build images / Build (sword-container-builder) (push) Failing after 1s
buildbot/nix-eval Build done.
buildbot/nix-build Build done.
buildbot/nix-effects Build done.
Build images / Build (vm-test) (push) Failing after 1s
This commit is contained in:
@@ -1,45 +1,65 @@
|
||||
{ lib, nix2container, pkgs, ... }:
|
||||
{ nix2container, lib, ... }:
|
||||
|
||||
lib.extend (
|
||||
final: prev: {
|
||||
img = {
|
||||
baseImage = final.img.mkImage {
|
||||
name = "base";
|
||||
layers = [
|
||||
(final.img.baseLayer pkgs)
|
||||
];
|
||||
};
|
||||
rec {
|
||||
baseImage =
|
||||
pkgs:
|
||||
mkImage {
|
||||
inherit pkgs;
|
||||
name = "src.thehellings.com/greg/base";
|
||||
};
|
||||
|
||||
baseLayer = pkgs: with pkgs; {
|
||||
deps = [
|
||||
bashInteractive
|
||||
coreutils
|
||||
dockerTools.binSh
|
||||
dockerTools.caCertificates
|
||||
dockerTools.usrBinEnv
|
||||
findutils
|
||||
gnugrep
|
||||
gnused
|
||||
];
|
||||
};
|
||||
baseLayer =
|
||||
pkgs: with pkgs; {
|
||||
deps = [
|
||||
(pkgs.buildEnv {
|
||||
name = "base-env";
|
||||
paths = [
|
||||
bashInteractive
|
||||
coreutils-full
|
||||
dockerTools.binSh
|
||||
dockerTools.caCertificates
|
||||
dockerTools.shadowSetup
|
||||
dockerTools.usrBinEnv
|
||||
findutils
|
||||
gnugrep
|
||||
gnused
|
||||
];
|
||||
})
|
||||
];
|
||||
};
|
||||
|
||||
foldLayers = let
|
||||
merge = parents: current: let
|
||||
layer = nix2container.buildlayer( current // {
|
||||
layers = parents;
|
||||
});
|
||||
in
|
||||
parents ++ [ layer ];
|
||||
in
|
||||
layers: final.foldl merge [] layers;
|
||||
foldLayers =
|
||||
let
|
||||
merge =
|
||||
parents: current:
|
||||
let
|
||||
layer = nix2container.buildLayer (
|
||||
current
|
||||
// {
|
||||
layers = parents;
|
||||
}
|
||||
);
|
||||
in
|
||||
parents ++ [ layer ];
|
||||
in
|
||||
layers: lib.foldl merge [ ] layers;
|
||||
|
||||
mkImage = {
|
||||
name,
|
||||
layers ? [],
|
||||
}: nix2container.buildImage {
|
||||
inherit name;
|
||||
layers = final.img.foldLayers layers;
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
mkImage =
|
||||
pkgs: config:
|
||||
let
|
||||
base = baseLayer pkgs;
|
||||
path = pkgs.lib.makeBinPath (base.deps ++ lib.flatten (builtins.map (e: e.deps) config.layers));
|
||||
in
|
||||
nix2container.buildImage (
|
||||
(lib.mergeAttrs {
|
||||
tag = "latest";
|
||||
config = {
|
||||
Env = [ "PATH=${path}" ];
|
||||
Cmd = [ "${pkgs.bashInteractive}/bin/bash" ];
|
||||
};
|
||||
} config)
|
||||
// {
|
||||
layers = foldLayers ([ base ] ++ config.layers);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user