buildLayeredImage: Allow empty store, no paths to add
This is useful when buildLayeredImage is called in a generic way that should allow simple (base) images to be built, which may not reference any store paths.
This commit is contained in:
@@ -258,4 +258,26 @@ rec {
|
||||
maxLayers = 2;
|
||||
};
|
||||
|
||||
# 17. Create a "layered" image without nix store layers. This is not
|
||||
# recommended, but can be useful for base images in rare cases.
|
||||
no-store-paths = pkgs.dockerTools.buildLayeredImage {
|
||||
name = "no-store-paths";
|
||||
tag = "latest";
|
||||
extraCommands = ''
|
||||
chmod a+w bin
|
||||
|
||||
# This removes sharing of busybox and is not recommended. We do this
|
||||
# to make the example suitable as a test case with working binaries.
|
||||
cp -r ${pkgs.pkgsStatic.busybox}/* .
|
||||
'';
|
||||
contents = [
|
||||
# This layer has no dependencies and its symlinks will be dereferenced
|
||||
# when creating the customization layer.
|
||||
(pkgs.runCommand "layer-to-flatten" {} ''
|
||||
mkdir -p $out/bin
|
||||
ln -s /bin/true $out/bin/custom-true
|
||||
''
|
||||
)
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user