mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-11-05 17:56:46 +01:00
25865688a7
This change adds granular, non-docker daemon docker image fetchers and a docker image layer compositor to be used in conjunction with the `docker2nix` utility provided by the `haskellPackages.hocker` package. This change includes a hackage package version bump and updated sha256 for recent fixes released to `hocker` resulting from formulating this patch.
29 lines
1.1 KiB
Bash
29 lines
1.1 KiB
Bash
source "${stdenv}/setup"
|
|
header "exporting ${repository}/${imageName} (tag: ${tag}) into ${out}"
|
|
mkdir -p "${out}"
|
|
|
|
cat <<EOF > "${out}/compositeImage.sh"
|
|
#! ${bash}/bin/bash
|
|
#
|
|
# Create a tar archive of a docker image's layers, docker image config
|
|
# json, manifest.json, and repositories json; this streams directly to
|
|
# stdout and is intended to be used in concert with docker load, i.e:
|
|
#
|
|
# ${out}/compositeImage.sh | docker load
|
|
|
|
# The first character follow the 's' command for sed becomes the
|
|
# delimiter sed will use; this makes the transformation regex easy to
|
|
# read. We feed tar a file listing the files we want in the archive,
|
|
# because the paths are absolute and docker load wants them flattened in
|
|
# the archive, we need to transform all of the paths going in by
|
|
# stripping everything *including* the last solidus so that we end up
|
|
# with the basename of the path.
|
|
${gnutar}/bin/tar \
|
|
--transform='s=.*/==' \
|
|
--transform="s=.*-manifest.json=manifest.json=" \
|
|
--transform="s=.*-repositories=repositories=" \
|
|
-c "${manifest}" "${repositories}" -T "${imageFileStorePaths}"
|
|
EOF
|
|
chmod +x "${out}/compositeImage.sh"
|
|
stopNest
|