pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / build-support / fetchdocker / fetchdocker-builder.sh
blob489914a2a8b431e3432df533949140e193631017
1 if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi
2 source "${stdenv}/setup"
3 echo "exporting ${repository}/${imageName} (tag: ${tag}) into ${out}"
4 mkdir -p "${out}"
6 cat <<EOF > "${out}/compositeImage.sh"
7 #! ${bash}/bin/bash
9 # Create a tar archive of a docker image's layers, docker image config
10 # json, manifest.json, and repositories json; this streams directly to
11 # stdout and is intended to be used in concert with docker load, i.e:
13 # ${out}/compositeImage.sh | docker load
15 # The first character follow the 's' command for sed becomes the
16 # delimiter sed will use; this makes the transformation regex easy to
17 # read. We feed tar a file listing the files we want in the archive,
18 # because the paths are absolute and docker load wants them flattened in
19 # the archive, we need to transform all of the paths going in by
20 # stripping everything *including* the last solidus so that we end up
21 # with the basename of the path.
22 ${gnutar}/bin/tar \
23 --transform='s=.*/==' \
24 --transform="s=.*-manifest.json=manifest.json=" \
25 --transform="s=.*-repositories=repositories=" \
26 -c "${manifest}" "${repositories}" -T "${imageFileStorePaths}"
27 EOF
28 chmod +x "${out}/compositeImage.sh"