all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Chris Marusich <cmmarusich@gmail.com>
To: Danny Milosavljevic <dannym@scratchpost.org>
Cc: 30572@debbugs.gnu.org, Chris Marusich <cmmarusich@gmail.com>
Subject: [bug#30572] [PATCH 5/7] docker: Allow the addition of extra files into the image.
Date: Mon, 26 Feb 2018 17:25:21 +0100	[thread overview]
Message-ID: <87muzvra4u.fsf@garuda.local.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <20180226003647.6174ad02@scratchpost.org> (Danny Milosavljevic's message of "Mon, 26 Feb 2018 00:36:47 +0100")


[-- Attachment #1.1: Type: text/plain, Size: 693 bytes --]

Danny Milosavljevic <dannym@scratchpost.org> 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 prefer:
>
> 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?

-- 
Chris

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0005-docker-Allow-the-addition-of-extra-files-into-the-im.patch --]
[-- Type: text/x-patch, Size: 2674 bytes --]

From 5a889e7d8dc6847c2d9a8ae526df7c974688a947 Mon Sep 17 00:00:00 2001
From: Chris Marusich <cmmarusich@gmail.com>
Date: Mon, 19 Feb 2018 05:53:16 +0100
Subject: [PATCH 5/8] docker: Allow the addition of extra files into the image.

* guix/docker.scm (build-docker-image): Add #:extra-items-dir keyword
  argument.
---
 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
--- 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))
-                             (tmpdir "/tmp/docker-image"))
+                             (tmpdir "/tmp/docker-image")
+                             extra-items-dir)
   "Write to IMAGE a Docker image archive from the given store PATH.  The image
 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 creation 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 because
 the default temporary directory lies on a file system with insufficient
-space."
+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 copied
+into the root directory of the image, so a file EXTRA-ITEMS-DIR/foo will wind
+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-source)
-                                   symlinks)))))
+                                   symlinks))
+                    extra-items-dir
+                    (zero? (apply system* "tar" "-rf" "layer.tar"
+                                  "-C" extra-items-dir
+                                  (append %tar-determinism-options
+                                          '(".")))))))
 
            (with-output-to-file "config.json"
              (lambda ()
-- 
2.15.1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2018-02-26 16:26 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <handler.30572.B.151929540925748.ack@debbugs.gnu.org>
2018-02-22 10:35 ` [bug#30572] [PATCH 1/7] tests: Add tests for "guix pack" Chris Marusich
2018-02-22 10:35   ` [bug#30572] [PATCH 2/7] vm: Allow control of deduplication in root-partition-initializer Chris Marusich
2018-02-25 14:02     ` Danny Milosavljevic
2018-02-22 10:35   ` [bug#30572] [PATCH 3/7] system: Allow customization of the initrd's Guile Chris Marusich
2018-02-22 12:10     ` Chris Marusich
2018-02-27 17:04       ` Ludovic Courtès
2018-03-07  5:56         ` Chris Marusich
2018-03-07 15:20           ` Ludovic Courtès
2018-02-22 10:35   ` [bug#30572] [PATCH 4/7] docker: Allow the use of a custom temporary directory Chris Marusich
2018-02-26  0:48     ` Danny Milosavljevic
2018-02-26 16:23       ` Chris Marusich
2018-02-26 23:46         ` Danny Milosavljevic
2018-02-27  4:43           ` Chris Marusich
2018-02-27 17:00             ` Ludovic Courtès
2018-03-07  6:24               ` Chris Marusich
2018-03-07 15:24                 ` Ludovic Courtès
2018-02-22 10:35   ` [bug#30572] [PATCH 5/7] docker: Allow the addition of extra files into the image Chris Marusich
2018-02-25 23:36     ` Danny Milosavljevic
2018-02-26 16:25       ` Chris Marusich [this message]
2018-02-26 23:47         ` Danny Milosavljevic
2018-02-27 17:08         ` Ludovic Courtès
2018-02-22 10:35   ` [bug#30572] [PATCH 6/7] system: Add "guix system docker-image" command Chris Marusich
2018-02-26 16:30     ` Chris Marusich
2018-02-27 17:17       ` Ludovic Courtès
2018-03-03  7:31         ` Chris Marusich
2018-02-22 10:35   ` [bug#30572] [PATCH 7/7] tests: Add tests for "guix system disk-image" et al Chris Marusich
2018-02-25 14:05     ` Danny Milosavljevic
2018-02-27 16:32   ` [bug#30572] [PATCH 1/7] tests: Add tests for "guix pack" Ludovic Courtès
2018-03-06  5:53     ` Chris Marusich
2018-03-08 21:05       ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87muzvra4u.fsf@garuda.local.i-did-not-set--mail-host-address--so-tickle-me \
    --to=cmmarusich@gmail.com \
    --cc=30572@debbugs.gnu.org \
    --cc=dannym@scratchpost.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.