1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00
nixpkgs/pkgs/build-support
Graham Christensen 4fe9006190 dockerTools.buildLayeredImage: init
Create a many-layered Docker Image.

Implements much less than buildImage:

 - Doesn't support specific uids/gids
 - Doesn't support runninng commands after building
 - Doesn't require qemu
 - Doesn't create mutable copies of the files in the path
 - Doesn't support parent images

If you want those feature, I recommend using buildLayeredImage as an
input to buildImage.

Notably, it does support:

 - Caching low level, common paths based on a graph traversial
   algorithm, see referencesByPopularity in
   0a80233487993256e811f566b1c80a40394c03d6
 - Configurable number of layers. If you're not using AUFS or not
   extending the image, you can specify a larger number of layers at
   build time:

       pkgs.dockerTools.buildLayeredImage {
         name = "hello";
         maxLayers = 128;
         config.Cmd = [ "${pkgs.gitFull}/bin/git" ];
       };

 - Parallelized creation of the layers, improving build speed.
 - The contents of the image includes the closure of the configuration,
   so you don't have to specify paths in contents and config.

   With buildImage, paths referred to by the config were not included
   automatically in the image. Thus, if you wanted to call Git, you
   had to specify it twice:

       pkgs.dockerTools.buildImage {
         name = "hello";
         contents = [ pkgs.gitFull ];
         config.Cmd = [ "${pkgs.gitFull}/bin/git" ];
       };

   buildLayeredImage on the other hand includes the runtime closure of
   the config when calculating the contents of the image:

       pkgs.dockerTools.buildImage {
         name = "hello";
         config.Cmd = [ "${pkgs.gitFull}/bin/git" ];
       };

Minor Problems

 - If any of the store paths change, every layer will be rebuilt in
   the nix-build. However, beacuse the layers are bit-for-bit
   reproducable, when these images are loaded in to Docker they will
   match existing layers and not be imported or uploaded twice.

Common Questions

 - Aren't Docker layers ordered?

   No. People who have used a Dockerfile before assume Docker's
   Layers are inherently ordered. However, this is not true -- Docker
   layers are content-addressable and are not explicitly layered until
   they are composed in to an Image.

 - What happens if I have more than maxLayers of store paths?

   The first (maxLayers-2) most "popular" paths will have their own
   individual layers, then layer #(maxLayers-1) will contain all the
   remaining "unpopular" paths, and finally layer #(maxLayers) will
   contain the Image configuration.
2018-09-26 17:54:14 -04:00
..
agda agda: Remove unused/uneeded abstractions, including postprocess 2015-05-31 01:55:10 +00:00
bintools-wrapper Revert "Merge pull request #44767 from obsidiansystems/wrapper-env-var-path" 2018-08-22 01:14:53 +02:00
build-bazel-package bazel-deps: init at 2018-05-31 (#43018) 2018-07-09 22:38:45 +00:00
build-dotnet-package treewide: Manual fix more pkg-config build-inputs 2017-09-21 15:49:54 -04:00
build-fhs-userenv reewide: Purge all uses stdenv.system and top-level system 2018-08-30 17:20:32 -04:00
build-setupcfg Revert "buildSetupcfg: Include unzip for zip sources." 2018-04-14 20:12:22 -04:00
buildenv Merge pull request #27780 from tilpner/overridable-buildenv 2017-09-14 17:26:33 +02:00
cc-wrapper treewide: cleanup some references to bash 2018-09-04 22:05:02 +00:00
docker dockerTools.buildLayeredImage: init 2018-09-26 17:54:14 -04:00
dotnetbuildhelpers Replace hard coded /bin/bash occurrences 2016-10-04 20:15:37 +02:00
dotnetenv [bot]: remove unreferenced code 2018-07-20 18:48:37 +00:00
emacs Fix pname to ename propagation if null 2018-07-27 08:15:46 +02:00
expand-response-params expand-response-params: Build more normally 2017-08-25 15:10:02 -04:00
fetchbower Merge remote-tracking branch 'upstream/master' into staging 2018-01-14 21:18:27 +02:00
fetchbzr treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchcvs bsd: init netbsd & openbsd userland 2018-04-24 14:16:35 -05:00
fetchdarcs pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00:00
fetchdocker Merge branch 'no-toPath' 2018-09-06 08:09:53 -04:00
fetchegg treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchfossil treewide: Fixed output fetch* derivations should use nativeBuildInputs 2018-01-09 20:14:46 -05:00
fetchgit pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00:00
fetchgitlocal pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00:00
fetchgx Merge remote-tracking branch 'upstream/master' into staging 2018-01-14 21:18:27 +02:00
fetchhg pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00:00
fetchipfs treewide: Fixed output fetch* derivations should use nativeBuildInputs 2018-01-09 20:14:46 -05:00
fetchmavenartifact fetchMavenArtifact: init (#16825) 2016-07-19 09:48:36 +02:00
fetchmtn treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchnuget pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00:00
fetchpatch fetchpatch: patchutils -> buildPackages.patchutils 2018-08-21 17:21:25 -04:00
fetchrepoproject treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchs3 pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00:00
fetchsvn treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchsvnrevision Live builds support: initially for git and svn. taglib_live is packaged as an example. 2011-01-02 23:23:59 +00:00
fetchsvnssh treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchurl fetchurl: add sageupstream mirror 2018-06-30 01:20:44 +02:00
fetchzip fetchzip: Use unzip from buildPackages 2018-09-21 12:55:32 -04:00
icon-conv-tools treewide: Add lots of meta.platforms 2016-08-02 21:42:43 +03:00
kernel treewide: Remove usage of remaining redundant platform compatability stuff 2018-08-30 17:20:32 -04:00
libredirect libredirect: add description 2017-12-14 19:03:35 +00:00
make-desktopitem make-desktopitem: make genericName optional 2017-06-05 21:55:23 -05:00
make-startupitem make-autostartitem: Use the right path for storing the desktop files 2017-07-06 00:44:41 +02:00
make-symlinks * "." -> "source". 2005-12-05 14:11:09 +00:00
mkshell mkShell: add builder (#30975) 2017-12-20 23:42:07 +00:00
mono-dll-fixer
nix-prefetch-github nix-prefetch-github: init -> 1.3 2018-05-22 20:55:07 +02:00
nuke-references
ocaml
references-by-popularity referencesByPopularity: init to sort packages by a cachability heuristic 2018-09-26 15:50:10 -04:00
release reewide: Purge all uses stdenv.system and top-level system 2018-08-30 17:20:32 -04:00
remove-references-to Add removeReferencesTo for removing specific refs 2017-03-09 12:01:55 +00:00
rust buildRustCrate: added some edge cases with binaries 2018-09-13 22:00:29 +02:00
setup-hooks makeWrapper: document --set-default 2018-08-24 19:46:16 +02:00
singularity-tools pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00:00
skaware skaware: switch from git repos to tarballs 2018-09-06 11:53:22 +02:00
src-only A helper to get the source some package is built from. 2008-10-01 15:57:22 +00:00
substitute Add stdenvNoCC 2016-09-29 13:06:41 +02:00
substitute-files substituteAllFiles: support postInstall 2016-01-10 06:03:26 +03:00
templaterpm
upstream-updater Fix #4210: Remove builderDefs 2016-08-31 11:34:46 +02:00
vm virtualization/qemu-vm: fix and improve virtio/scsi switching 2018-09-22 23:29:19 +02:00
wrapper-common {bintools,cc}-wrapper: Factor out role accumulation logic 2018-05-07 15:10:45 -04:00
build-maven.nix buildMaven: Check for authenticated attribute 2018-07-25 16:00:52 +02:00
build-pecl.nix Revert "fix phpPackages memcache,memcached,xdebug" 2017-12-10 12:12:43 +01:00
closure-info.nix Cleanup 2018-02-27 19:59:26 +01:00
dhall-to-nix.nix Add a pkgs.dhallToNix utility 2017-01-26 20:11:49 -08:00
plugins.nix Ultrastar (#26524) 2017-06-14 11:29:31 +02:00
replace-dependency.nix replaceDependency: fix syntax error 2016-10-28 01:00:04 +02:00
setup-systemd-units.nix Add setupSystemdUnits function. 2017-03-24 15:47:51 -04:00
source-from-head-fun.nix
trivial-builders.nix lib: ensure directories of linkFarm links exist (#45628) 2018-09-01 14:53:23 +02:00