From patchwork Sun May 12 10:38:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 13962 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 9411F16FD2; Sun, 12 May 2019 11:39:24 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 11C9F16F26 for ; Sun, 12 May 2019 11:39:24 +0100 (BST) Received: from localhost ([127.0.0.1]:41525 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hPlt5-0007E7-IK for patchwork@mira.cbaines.net; Sun, 12 May 2019 06:39:23 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hPlso-00071k-Sz for guix-patches@gnu.org; Sun, 12 May 2019 06:39:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hPlsn-0007XP-Kd for guix-patches@gnu.org; Sun, 12 May 2019 06:39:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56639) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hPlsn-0007Wb-0r for guix-patches@gnu.org; Sun, 12 May 2019 06:39:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hPlsm-0002ts-UI for guix-patches@gnu.org; Sun, 12 May 2019 06:39:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#35697] [PATCH 7/8] docker: 'build-docker-image' accepts an optional #:entry-point. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 12 May 2019 10:39:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35697 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 35697@debbugs.gnu.org Received: via spool by 35697-submit@debbugs.gnu.org id=B35697.155765750811059 (code B ref 35697); Sun, 12 May 2019 10:39:04 +0000 Received: (at 35697) by debbugs.gnu.org; 12 May 2019 10:38:28 +0000 Received: from localhost ([127.0.0.1]:41942 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hPlsC-0002sC-9c for submit@debbugs.gnu.org; Sun, 12 May 2019 06:38:28 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38686) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hPls9-0002qs-5v for 35697@debbugs.gnu.org; Sun, 12 May 2019 06:38:25 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:54355) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hPls4-0007Ji-11; Sun, 12 May 2019 06:38:20 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=41590 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hPls3-00052w-Hj; Sun, 12 May 2019 06:38:19 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sun, 12 May 2019 12:38:01 +0200 Message-Id: <20190512103802.17032-7-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190512103802.17032-1-ludo@gnu.org> References: <20190512103802.17032-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chris Marusich Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * guix/docker.scm (config): Add #:entry-point and honor it. (build-docker-image): Likewise. --- guix/docker.scm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/guix/docker.scm b/guix/docker.scm index c6e9c6fee5..7fe83d9797 100644 --- a/guix/docker.scm +++ b/guix/docker.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017 Ricardo Wurmus -;;; Copyright © 2017, 2018 Ludovic Courtès +;;; Copyright © 2017, 2018, 2019 Ludovic Courtès ;;; Copyright © 2018 Chris Marusich ;;; ;;; This file is part of GNU Guix. @@ -73,7 +73,7 @@ `((,(generate-tag path) . ((latest . ,id))))) ;; See https://github.com/opencontainers/image-spec/blob/master/config.md -(define (config layer time arch) +(define* (config layer time arch #:key entry-point) "Generate a minimal image configuration for the given LAYER file." ;; "architecture" must be values matching "platform.arch" in the ;; runtime-spec at @@ -81,7 +81,9 @@ `((architecture . ,arch) (comment . "Generated by GNU Guix") (created . ,time) - (config . #nil) + (config . ,(if entry-point + `((entrypoint . ,entry-point)) + #nil)) (container_config . #nil) (os . "linux") (rootfs . ((type . "layers") @@ -110,6 +112,7 @@ return \"a\"." (transformations '()) (system (utsname:machine (uname))) database + entry-point compressor (creation-time (current-time time-utc))) "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. When DATABASE is true, copy it to /var/guix/db in the image and create /var/guix/gcroots and friends. +When ENTRY-POINT is true, it must be a list of strings; it is stored as the +entry point in the Docker image JSON structure. + SYMLINKS must be a list of (SOURCE -> TARGET) tuples describing symlinks to be created in the image, where each TARGET is relative to PREFIX. 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." (with-output-to-file "config.json" (lambda () (scm->json (config (string-append id "/layer.tar") - time arch)))) + time arch + #:entry-point entry-point)))) (with-output-to-file "manifest.json" (lambda () (scm->json (manifest prefix id))))