Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 071693e5df98
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 90ff6b1d030e
Choose a head ref
  • 3 commits
  • 1 file changed
  • 1 contributor

Commits on Jul 1, 2017

  1. Copy the full SHA
    dde5865 View commit details

Commits on Jul 8, 2017

  1. Copy the full SHA
    83fbc0f View commit details

Commits on Jul 15, 2017

  1. Merge pull request #27017 from LnL7/docker-pure-layer

    docker-tools: set user/group when creating a pure layer
    LnL7 authored Jul 15, 2017
    Copy the full SHA
    90ff6b1 View commit details
Showing with 9 additions and 6 deletions.
  1. +9 −6 pkgs/build-support/docker/default.nix
15 changes: 9 additions & 6 deletions pkgs/build-support/docker/default.nix
Original file line number Diff line number Diff line change
@@ -234,11 +234,10 @@ rec {
# Files to add to the layer.
contents ? null,
# Additional commands to run on the layer before it is tar'd up.
extraCommands ? ""
extraCommands ? "", uid ? 0, gid ? 0
}:
runCommand "docker-layer-${name}" {
inherit baseJson contents extraCommands;

buildInputs = [ jshon rsync ];
}
''
@@ -253,14 +252,16 @@ rec {
echo "No contents to add to layer."
fi
chmod ug+w layer
if [[ -n $extraCommands ]]; then
(cd layer; eval "$extraCommands")
fi
# Tar up the layer and throw it into 'layer.tar'.
echo "Packing layer..."
mkdir $out
tar -C layer --mtime="@$SOURCE_DATE_EPOCH" -cf $out/layer.tar .
tar -C layer --mtime="@$SOURCE_DATE_EPOCH" --owner=${toString uid} --group=${toString gid} -cf $out/layer.tar .
# Compute a checksum of the tarball.
echo "Computing layer checksum..."
@@ -312,6 +313,8 @@ rec {
echo "Adding $item..."
rsync -ak --chown=0:0 $item/ layer/
done
chmod ug+w layer
'';

postMount = ''
@@ -375,7 +378,7 @@ rec {
# Docker config; e.g. what command to run on the container.
config ? null,
# Optional bash script to run on the files prior to fixturizing the layer.
extraCommands ? "",
extraCommands ? "", uid ? 0, gid ? 0,
# Optional bash script to run as root on the image when provisioning.
runAsRoot ? null,
# Size of the virtual machine disk to provision when building the image.
@@ -398,7 +401,7 @@ rec {
if runAsRoot == null
then mkPureLayer {
name = baseName;
inherit baseJson contents extraCommands;
inherit baseJson contents extraCommands uid gid;
} else mkRootLayer {
name = baseName;
inherit baseJson fromImage fromImageName fromImageTag
@@ -498,7 +501,7 @@ rec {
chmod -R a-w image
echo "Cooking the image..."
tar -C image --mtime="@$SOURCE_DATE_EPOCH" -c . | pigz -nT > $out
tar -C image --mtime="@$SOURCE_DATE_EPOCH" --owner=0 --group=0 -c . | pigz -nT > $out
echo "Finished."
'';