Use streamLayeredImage for base image

This commit is contained in:
Robert Hensing 2021-05-24 12:28:17 +02:00
parent b83cf51efd
commit ad41d1e39b

View File

@ -6,11 +6,9 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
tag = lib.head (lib.strings.splitString "-" (baseNameOf builtImage.outPath));
name = "arion-base"; name = "arion-base";
builtImage = pkgs.dockerTools.buildImage { imageExe = pkgs.dockerTools.streamLayeredImage {
inherit name; inherit name;
contents = pkgs.runCommand "minimal-contents" {} '' contents = pkgs.runCommand "minimal-contents" {} ''
mkdir -p $out/bin $out/usr/bin mkdir -p $out/bin $out/usr/bin
@ -19,6 +17,7 @@ let
''; '';
config = {}; config = {};
}; };
inherit (imageExe) imageTag;
in in
@ -33,9 +32,9 @@ in
}; };
config = { config = {
arionBaseImage = "${name}:${tag}"; arionBaseImage = "${name}:${imageTag}";
build.imagesToLoad = lib.mkIf (lib.any (s: s.service.useHostStore) (lib.attrValues config.services)) [ build.imagesToLoad = lib.mkIf (lib.any (s: s.service.useHostStore) (lib.attrValues config.services)) [
{ image = builtImage; imageName = name; imageTag = tag; } { imageExe = imageExe; imageName = name; inherit imageTag; }
]; ];
}; };
} }