Back to just dockerTools
buildbot/nix-eval Build done.
buildbot/nix-build Build done.
buildbot/nix-effects Build done.
Build images / Build (bitwarden) (push) Failing after 27s
Build images / Build (immich) (push) Failing after 2s
Build images / Build (sword-container-builder) (push) Failing after 2s
Build images / Build (builder) (push) Failing after 2s
Build images / Build (vm-test) (push) Failing after 2s
buildbot/nix-eval Build done.
buildbot/nix-build Build done.
buildbot/nix-effects Build done.
Build images / Build (bitwarden) (push) Failing after 27s
Build images / Build (immich) (push) Failing after 2s
Build images / Build (sword-container-builder) (push) Failing after 2s
Build images / Build (builder) (push) Failing after 2s
Build images / Build (vm-test) (push) Failing after 2s
This commit is contained in:
@@ -1,70 +1,30 @@
|
||||
{ nix2container, lib, ... }:
|
||||
{ pkgs, ... }:
|
||||
|
||||
rec {
|
||||
baseImage =
|
||||
pkgs:
|
||||
mkImage {
|
||||
inherit pkgs;
|
||||
name = "src.thehellings.com/greg/base";
|
||||
};
|
||||
|
||||
baseLayer =
|
||||
pkgs: with pkgs; rec {
|
||||
copyToRoot = deps;
|
||||
deps = [
|
||||
(pkgs.buildEnv {
|
||||
name = "base-env";
|
||||
paths = [
|
||||
bashInteractive
|
||||
cacert
|
||||
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: lib.foldl merge [ ] layers;
|
||||
{
|
||||
basePackages = with pkgs; rec {
|
||||
copyToRoot = paths;
|
||||
paths = [
|
||||
bashInteractive
|
||||
cacert
|
||||
coreutils-full
|
||||
dockerTools.binSh
|
||||
dockerTools.caCertificates
|
||||
dockerTools.shadowSetup
|
||||
dockerTools.usrBinEnv
|
||||
findutils
|
||||
gnugrep
|
||||
gnused
|
||||
];
|
||||
};
|
||||
|
||||
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 {
|
||||
options:
|
||||
pkgs.dockerTools.buildLayeredImage (
|
||||
pkgs.lib.mergeAttrs {
|
||||
tag = "latest";
|
||||
config = {
|
||||
Env = [
|
||||
"PATH=${path}"
|
||||
"USER=nobody"
|
||||
];
|
||||
Cmd = [ "${pkgs.bashInteractive}/bin/bash" ];
|
||||
};
|
||||
} config)
|
||||
// {
|
||||
layers = foldLayers ([ base ] ++ config.layers);
|
||||
}
|
||||
} options
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user