From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57161) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqLbL-0005vi-MA for guix-patches@gnu.org; Mon, 26 Feb 2018 11:26:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqLbG-0006vG-Og for guix-patches@gnu.org; Mon, 26 Feb 2018 11:26:07 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:54039) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eqLbG-0006vA-JW for guix-patches@gnu.org; Mon, 26 Feb 2018 11:26:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eqLbF-0004le-PA for guix-patches@gnu.org; Mon, 26 Feb 2018 11:26:01 -0500 Subject: [bug#30572] [PATCH 5/7] docker: Allow the addition of extra files into the image. Resent-Message-ID: From: Chris Marusich References: <20180222103528.5108-1-cmmarusich@gmail.com> <20180222103528.5108-5-cmmarusich@gmail.com> <20180226003647.6174ad02@scratchpost.org> Date: Mon, 26 Feb 2018 17:25:21 +0100 In-Reply-To: <20180226003647.6174ad02@scratchpost.org> (Danny Milosavljevic's message of "Mon, 26 Feb 2018 00:36:47 +0100") Message-ID: <87muzvra4u.fsf@garuda.local.i-did-not-set--mail-host-address--so-tickle-me> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Danny Milosavljevic Cc: 30572@debbugs.gnu.org, Chris Marusich --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Danny Milosavljevic writes: >> + (zero? (apply system* "tar" "-C" extra-items-dir >> + "-rf" "layer.tar" >> + (append %tar-determinism-options >> + '(".")))))))) > > -C is order-sensitive. Apparently it still doesn't cause layer.tar > to be created inside extra-items-dir (huh...), but for clarity, I'd prefe= r: > > tar -rf layer.tar -C extra-items-dir . I didn't realize this was the case. I agree it would be best to reverse the order here. I've attached a patch which does this. How does it look? =2D-=20 Chris --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0005-docker-Allow-the-addition-of-extra-files-into-the-im.patch Content-Transfer-Encoding: quoted-printable From=205a889e7d8dc6847c2d9a8ae526df7c974688a947 Mon Sep 17 00:00:00 2001 From: Chris Marusich Date: Mon, 19 Feb 2018 05:53:16 +0100 Subject: [PATCH 5/8] docker: Allow the addition of extra files into the ima= ge. * guix/docker.scm (build-docker-image): Add #:extra-items-dir keyword argument. =2D-- guix/docker.scm | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/guix/docker.scm b/guix/docker.scm index 305e8273b..ef92714e0 100644 =2D-- a/guix/docker.scm +++ b/guix/docker.scm @@ -107,7 +107,8 @@ return \"a\"." (symlinks '()) (system (utsname:machine (uname))) (creation-time (current-time time-utc)) =2D (tmpdir "/tmp/docker-image")) + (tmpdir "/tmp/docker-image") + extra-items-dir) "Write to IMAGE a Docker image archive from the given store PATH. The i= mage contains the closure of PATH, as specified in CLOSURE (a file produced by #:references-graphs). SYMLINKS must be a list of (SOURCE -> TARGET) tuples @@ -121,7 +122,12 @@ CREATION-TIME, a SRFI-19 time-utc object, as the creat= ion time in metadata. TMPDIR is the name of the temporary working directory to use. This can be useful if you need to use a specific temporary directory, for example beca= use the default temporary directory lies on a file system with insufficient =2Dspace." +space. + +EXTRA-ITEMS-DIR is the name of a directory containing extra files to add to +the image; the entire directory tree rooted at EXTRA-ITEMS-DIR will be cop= ied +into the root directory of the image, so a file EXTRA-ITEMS-DIR/foo will w= ind +up at /foo in the final Docker image." (let ((closure (canonicalize-path closure)) (id (docker-id path)) (time (date->string (time-utc->date creation-time) "~4")) @@ -166,7 +172,12 @@ space." (map symlink-source symlinks)))) (for-each delete-file-recursively (map (compose topmost-component symlink-sour= ce) =2D symlinks))))) + symlinks)) + extra-items-dir + (zero? (apply system* "tar" "-rf" "layer.tar" + "-C" extra-items-dir + (append %tar-determinism-options + '("."))))))) =20 (with-output-to-file "config.json" (lambda () =2D-=20 2.15.1 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEy/WXVcvn5+/vGD+x3UCaFdgiRp0FAlqUNPEACgkQ3UCaFdgi Rp3j9Q//T/dRavhYw/jwoHGrtbGvYSzXWPHJmdoG/V3kZowRge9Y3H+o1EdHGBnC j9xmEE0eMl4UPC4LDOrYOeON+mEZI+52rWfbgNtPbpx3dOdZDbLZSdv1UmDQGlBk Q1pImuoLTV2Q/cxNObdq7JcKMvWcyGtJAmzr0Agaks4MrQCV/Dvm8PYNoFTCSg63 j+ude7M7IF/IUD/oJgqR/CD6Ou3MZs0nRNWKcTcypSv4rH4Gxn74C7ngjTRl3Z10 9VZg3pLyu0RSeHUBDXjP/BaTRGr6K9a0eROwcgCr3fku+nGX4UHkxaRt3pLLfKwc CcD+P3OQ0gQTi7rn0NE0+m1bldZv2EsNKBHrEKmGwJURc+qF1JjfGTdCUMlbQjSM M9Zf3W5jj6SgWTTCaOZ6ff/6wZhcXWW2F0hwQnY/eVLMxBPZYGbU0eyupPcNuQMG SWhBW8JC5/cSanGyUa3/L6xcs+2v+4UHs45+iOS+jDEjJGBRYl3nQyuWIMDhmUa7 K0g67ZU0VSOSuvKBxMrKRheImfTuIyqE+x0qpeNtDEq1LLzk95WIlZdfmP8HG3Dp pc1wthHtdR+8lAY8JcyClbNVGwww6sFme7xSeEv3EHYzaccU3LeMxGpOZgBmYV7O PEGl1nu7nF3Ju8/ADdUedS7NtM1vYEiO1/TjcvOyiwoq2DNyYvI= =QAcT -----END PGP SIGNATURE----- --==-=-=--