diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2019-05-10 22:32:10 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2019-05-15 16:36:21 +0200 |
| commit | 7ff4fde257d43760b0df53334b4df63d16491452 (patch) | |
| tree | ace3559d045186e75a9e86ff5be1a6eeae4535a4 | |
| parent | 9fcfe30d283cd7d36c6e292ea1235eb24307b003 (diff) | |
docker: 'build-docker-image' accepts an optional #:entry-point.
* guix/docker.scm (config): Add #:entry-point and honor it.
(build-docker-image): Likewise.
| -rw-r--r-- | guix/docker.scm | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/guix/docker.scm b/guix/docker.scm index c6e9c6fee59..7fe83d9797e 100644 --- a/guix/docker.scm +++ b/guix/docker.scm | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net> | 2 | ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net> |
| 3 | ;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org> | 3 | ;;; Copyright © 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org> |
| 4 | ;;; Copyright © 2018 Chris Marusich <cmmarusich@gmail.com> | 4 | ;;; Copyright © 2018 Chris Marusich <cmmarusich@gmail.com> |
| 5 | ;;; | 5 | ;;; |
| 6 | ;;; This file is part of GNU Guix. | 6 | ;;; This file is part of GNU Guix. |
| @@ -73,7 +73,7 @@ | |||
| 73 | `((,(generate-tag path) . ((latest . ,id))))) | 73 | `((,(generate-tag path) . ((latest . ,id))))) |
| 74 | 74 | ||
| 75 | ;; See https://github.com/opencontainers/image-spec/blob/master/config.md | 75 | ;; See https://github.com/opencontainers/image-spec/blob/master/config.md |
| 76 | (define (config layer time arch) | 76 | (define* (config layer time arch #:key entry-point) |
| 77 | "Generate a minimal image configuration for the given LAYER file." | 77 | "Generate a minimal image configuration for the given LAYER file." |
| 78 | ;; "architecture" must be values matching "platform.arch" in the | 78 | ;; "architecture" must be values matching "platform.arch" in the |
| 79 | ;; runtime-spec at | 79 | ;; runtime-spec at |
| @@ -81,7 +81,9 @@ | |||
| 81 | `((architecture . ,arch) | 81 | `((architecture . ,arch) |
| 82 | (comment . "Generated by GNU Guix") | 82 | (comment . "Generated by GNU Guix") |
| 83 | (created . ,time) | 83 | (created . ,time) |
| 84 | (config . #nil) | 84 | (config . ,(if entry-point |
| 85 | `((entrypoint . ,entry-point)) | ||
| 86 | #nil)) | ||
| 85 | (container_config . #nil) | 87 | (container_config . #nil) |
| 86 | (os . "linux") | 88 | (os . "linux") |
| 87 | (rootfs . ((type . "layers") | 89 | (rootfs . ((type . "layers") |
| @@ -110,6 +112,7 @@ return \"a\"." | |||
| 110 | (transformations '()) | 112 | (transformations '()) |
| 111 | (system (utsname:machine (uname))) | 113 | (system (utsname:machine (uname))) |
| 112 | database | 114 | database |
| 115 | entry-point | ||
| 113 | compressor | 116 | compressor |
| 114 | (creation-time (current-time time-utc))) | 117 | (creation-time (current-time time-utc))) |
| 115 | "Write to IMAGE a Docker image archive containing the given PATHS. PREFIX | 118 | "Write to IMAGE a Docker image archive containing the given PATHS. PREFIX |
| @@ -118,6 +121,9 @@ must be a store path that is a prefix of any store paths in PATHS. | |||
| 118 | When DATABASE is true, copy it to /var/guix/db in the image and create | 121 | When DATABASE is true, copy it to /var/guix/db in the image and create |
| 119 | /var/guix/gcroots and friends. | 122 | /var/guix/gcroots and friends. |
| 120 | 123 | ||
| 124 | When ENTRY-POINT is true, it must be a list of strings; it is stored as the | ||
| 125 | entry point in the Docker image JSON structure. | ||
| 126 | |||
| 121 | SYMLINKS must be a list of (SOURCE -> TARGET) tuples describing symlinks to be | 127 | SYMLINKS must be a list of (SOURCE -> TARGET) tuples describing symlinks to be |
| 122 | created in the image, where each TARGET is relative to PREFIX. | 128 | created in the image, where each TARGET is relative to PREFIX. |
| 123 | TRANSFORMATIONS must be a list of (OLD -> NEW) tuples describing how to | 129 | TRANSFORMATIONS must be a list of (OLD -> NEW) tuples describing how to |
| @@ -227,7 +233,8 @@ SRFI-19 time-utc object, as the creation time in metadata." | |||
| 227 | (with-output-to-file "config.json" | 233 | (with-output-to-file "config.json" |
| 228 | (lambda () | 234 | (lambda () |
| 229 | (scm->json (config (string-append id "/layer.tar") | 235 | (scm->json (config (string-append id "/layer.tar") |
| 230 | time arch)))) | 236 | time arch |
| 237 | #:entry-point entry-point)))) | ||
| 231 | (with-output-to-file "manifest.json" | 238 | (with-output-to-file "manifest.json" |
| 232 | (lambda () | 239 | (lambda () |
| 233 | (scm->json (manifest prefix id)))) | 240 | (scm->json (manifest prefix id)))) |
