linux-container: Do not add %CONTAINER-FILE-SYSTEMS to Docker image OSes.
[guix.git] / gnu / packages / docker.scm
blobeb76b85676a9bd92d7050d42c267a71a05c1afae
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016 David Thompson <davet@gnu.org>
3 ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
5 ;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
13 ;;;
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
22 (define-module (gnu packages docker)
23   #:use-module ((guix licenses) #:prefix license:)
24   #:use-module (gnu packages)
25   #:use-module (guix packages)
26   #:use-module (guix download)
27   #:use-module (guix git-download)
28   #:use-module (guix build-system gnu)
29   #:use-module (guix build-system go)
30   #:use-module (guix build-system python)
31   #:use-module (guix utils)
32   #:use-module (gnu packages autotools)
33   #:use-module (gnu packages base)
34   #:use-module (gnu packages check)
35   #:use-module (gnu packages compression)
36   #:use-module (gnu packages glib)
37   #:use-module (gnu packages golang)
38   #:use-module (gnu packages linux)
39   #:use-module (gnu packages networking)
40   #:use-module (gnu packages pkg-config)
41   #:use-module (gnu packages python)
42   #:use-module (gnu packages python-web)
43   #:use-module (gnu packages python-xyz)
44   #:use-module (gnu packages version-control)
45   #:use-module (gnu packages virtualization))
47 (define %docker-version "18.09.5")
49 (define-public python-docker-py
50   (package
51     (name "python-docker-py")
52     (version "1.10.6")
53     (source
54      (origin
55        (method url-fetch)
56        (uri (pypi-uri "docker-py" version))
57        (sha256
58         (base32
59          "05f49f6hnl7npmi7kigg0ibqk8s3fhzx1ivvz1kqvlv4ay3paajc"))))
60     (build-system python-build-system)
61     ;; TODO: Tests require a running Docker daemon.
62     (arguments '(#:tests? #f))
63     (inputs
64      `(("python-requests" ,python-requests)
65        ("python-six" ,python-six)
66        ("python-websocket-client" ,python-websocket-client)))
67     (home-page "https://github.com/docker/docker-py/")
68     (synopsis "Python client for Docker")
69     (description "Docker-Py is a Python client for the Docker container
70 management tool.")
71     (license license:asl2.0)))
73 (define-public python-dockerpty
74   (package
75     (name "python-dockerpty")
76     (version "0.3.4")
77     (source
78      (origin
79        (method url-fetch)
80        (uri (pypi-uri "dockerpty" version))
81        (sha256
82         (base32
83          "0za6rr349641wv76ww9l3zcic2xyxrirlxpnzl4296h897648455"))))
84     (build-system python-build-system)
85     (native-inputs
86      `(("python-six" ,python-six)))
87     (home-page "https://github.com/d11wtq/dockerpty")
88     (synopsis "Python library to use the pseudo-TTY of a Docker container")
89     (description "Docker PTY provides the functionality needed to operate the
90 pseudo-terminal (PTY) allocated to a Docker container using the Python
91 client.")
92     (license license:asl2.0)))
94 (define-public docker-compose
95   (package
96     (name "docker-compose")
97     (version "1.5.2")
98     (source
99      (origin
100        (method url-fetch)
101        (uri (pypi-uri "docker-compose" version))
102        (sha256
103         (base32
104          "0ksg7hm2yvc977968dixxisrhcmvskzpcx3pz0v1kazrdqp7xakr"))))
105     (build-system python-build-system)
106     ;; TODO: Tests require running Docker daemon.
107     (arguments '(#:tests? #f))
108     (inputs
109      `(("python-docker-py" ,python-docker-py)
110        ("python-dockerpty" ,python-dockerpty)
111        ("python-docopt" ,python-docopt)
112        ("python-jsonschema" ,python-jsonschema)
113        ("python-pyyaml" ,python-pyyaml)
114        ("python-requests" ,python-requests-2.7)
115        ("python-six" ,python-six)
116        ("python-texttable" ,python-texttable)
117        ("python-websocket-client" ,python-websocket-client)))
118     (home-page "https://www.docker.com/")
119     (synopsis "Multi-container orchestration for Docker")
120     (description "Docker Compose is a tool for defining and running
121 multi-container Docker applications.  A Compose file is used to configure an
122 application’s services.  Then, using a single command, the containers are
123 created and all the services are started as specified in the configuration.")
124     (license license:asl2.0)))
126 (define-public python-docker-pycreds
127   (package
128     (name "python-docker-pycreds")
129     (version "0.3.0")
130     (source
131       (origin
132         (method url-fetch)
133         (uri (pypi-uri "docker-pycreds" version))
134         (sha256
135          (base32
136           "1zxvam1q22qb0jf48553nnncnfrcp88ag4xa0qmq6vr0imn9a3lb"))))
137     (build-system python-build-system)
138     (arguments
139      `(#:phases
140        (modify-phases %standard-phases
141          (add-after 'unpack 'fix-versioning
142            (lambda _
143              (substitute* "test-requirements.txt"
144                (("3.0.2") ,(package-version python-pytest))
145                (("2.3.1") ,(package-version python-pytest-cov))
146                (("2.4.1") ,(package-version python-flake8)))
147              #t)))))
148     (native-inputs
149      `(("python-flake8" ,python-flake8)
150        ("python-pytest" ,python-pytest)
151        ("python-pytest-cov" ,python-pytest-cov)))
152     (propagated-inputs
153      `(("python-six" ,python-six)))
154     (home-page "https://github.com/shin-/dockerpy-creds")
155     (synopsis
156      "Python bindings for the Docker credentials store API")
157     (description
158      "Docker-Pycreds contains the Python bindings for the docker credentials
159 store API.  It allows programmers to interact with a Docker registry using
160 Python without keeping their credentials in a Docker configuration file.")
161     (license license:asl2.0)))
163 (define-public containerd
164   (package
165     (name "containerd")
166     (version "1.2.5")
167     (source
168      (origin
169       (method git-fetch)
170       (uri (git-reference
171             (url "https://github.com/containerd/containerd.git")
172             (commit (string-append "v" version))))
173       (file-name (git-file-name name version))
174       (sha256
175        (base32 "0npbzixf3c0jvzm159vygvkydrr8h36c9sq50yv0mdinrys2bvg0"))))
176     (build-system go-build-system)
177     (arguments
178      `(#:import-path "github.com/containerd/containerd"
179        #:phases
180        (modify-phases %standard-phases
181          (add-before 'build 'chdir
182            (lambda _
183              (chdir "src/github.com/containerd/containerd")
184              #t))
185          (add-after 'chdir 'patch-paths
186            (lambda* (#:key inputs outputs #:allow-other-keys)
187              ;; TODO: Patch "socat", "unpigz".
188              (substitute* "./runtime/v1/linux/runtime.go"
189               (("defaultRuntime[ \t]*=.*")
190                (string-append "defaultRuntime = \""
191                               (assoc-ref inputs "runc")
192                               "/sbin/runc\"\n"))
193               (("defaultShim[ \t]*=.*")
194                (string-append "defaultShim = \""
195                               (assoc-ref outputs "out")
196                               "/bin/containerd-shim\"\n")))
197             (substitute* "./vendor/github.com/containerd/go-runc/runc.go"
198               (("DefaultCommand[ \t]*=.*")
199                (string-append "DefaultCommand = \""
200                               (assoc-ref inputs "runc")
201                               "/sbin/runc\"\n")))
202             (substitute* "vendor/github.com/containerd/continuity/testutil/loopback/loopback_linux.go"
203              (("exec\\.Command\\(\"losetup\"") ; )
204               (string-append "exec.Command(\""
205                              (assoc-ref inputs "util-linux")
206                              "/sbin/losetup\""))) ;)
207              #t))
208          (replace 'build
209            (lambda* (#:key (make-flags '()) #:allow-other-keys)
210              (apply invoke "make" make-flags)))
211          (replace 'install
212            (lambda* (#:key outputs (make-flags '()) #:allow-other-keys)
213              (let* ((out (assoc-ref outputs "out")))
214                (apply invoke "make" (string-append "DESTDIR=" out) "install"
215                       make-flags)))))))
216     (inputs
217      `(("btrfs-progs" ,btrfs-progs)
218        ("libseccomp" ,libseccomp)
219        ("runc" ,runc)
220        ("util-linux" ,util-linux)))
221     (native-inputs
222      `(("go" ,go)
223        ("pkg-config" ,pkg-config)))
224     (synopsis "Docker container runtime")
225     (description "This package provides the container daemon for Docker.
226 It includes image transfer and storage, container execution and supervision,
227 network attachments.")
228     (home-page "http://containerd.io/")
229     (license license:asl2.0)))
231 ;;; Private package that shouldn't be used directly; its purposes is to be
232 ;;; used as a template for the various packages it contains.  It doesn't build
233 ;;; anyway, as it needs many dependencies that aren't being satisfied.
234 (define docker-libnetwork
235   ;; There are no recent release for libnetwork, so choose the last commit of
236   ;; the branch that Docker uses, as can be seen in the Docker source file
237   ;; 'hack/dockerfile/install/proxy.installer'.
238   (let ((commit "4725f2163fb214a6312f3beae5991f838ec36326")
239         (version "18.09")
240         (revision "1"))
241     (package
242       (name "docker-libnetwork")
243       (version (git-version version "1" commit))
244       (source (origin
245                 (method git-fetch)
246                 (uri (git-reference
247                       (url "https://github.com/docker/libnetwork.git")
248                       (commit commit)))
249                 (file-name (git-file-name name version))
250                 (sha256
251                  (base32
252                   "1zpnxki8qfzha6ljahpwd3vkzmjhsvkmf73w6crm4ilxxw5vnpfb"))
253                 ;; Delete bundled ("vendored") free software source code.
254                 (modules '((guix build utils)))
255                 (snippet '(begin
256                             (delete-file-recursively "vendor")
257                             #t))))
258       (build-system go-build-system)
259       (arguments
260        `(#:import-path "github.com/docker/libnetwork/"))
261       (home-page "https://github.com/docker/libnetwork/")
262       (synopsis "Networking for containers")
263       (description "Libnetwork provides a native Go implementation for
264 connecting containers.  The goal of @code{libnetwork} is to deliver a robust
265 container network model that provides a consistent programming interface and
266 the required network abstractions for applications.")
267       (license license:asl2.0))))
269 (define-public docker-libnetwork-cmd-proxy
270   (package
271     (inherit docker-libnetwork)
272     (name "docker-libnetwork-cmd-proxy")
273     (arguments
274      `(#:import-path "github.com/docker/libnetwork/cmd/proxy"
275        #:unpack-path "github.com/docker/libnetwork"
276        #:install-source? #f))
277     (native-inputs
278      `(("go-sctp" ,go-sctp)
279        ;; For tests.
280        ("logrus" ,go-github-com-sirupsen-logrus)
281        ("go-netlink" ,go-netlink)
282        ("go-netns" ,go-netns)
283        ("go-golang-org-x-crypto-ssh-terminal"
284         ,go-golang-org-x-crypto-ssh-terminal)
285        ("go-golang-org-x-sys-unix" ,go-golang-org-x-sys-unix)))
286     (synopsis "Docker user-space proxy")
287     (description "A proxy running in the user space.  It is used by the
288 built-in registry server of Docker.")
289     (license license:asl2.0)))
291 ;; TODO: Patch out modprobes for ip_vs, nf_conntrack,
292 ;; brige, nf_conntrack_netlink, aufs.
293 (define-public docker
294   (package
295     (name "docker")
296     (version %docker-version)
297     (source
298      (origin
299        (method git-fetch)
300        (uri (git-reference
301              (url "https://github.com/docker/engine.git")
302              (commit (string-append "v" version))))
303        (file-name (git-file-name name version))
304        (sha256
305         (base32 "0cirpd9l2qazp2jyanwzvrkx2m98nksjdvn43ff38p89w6133ipb"))
306        (patches
307         (search-patches "docker-engine-test-noinstall.patch"
308                         "docker-fix-tests.patch"
309                         "docker-use-fewer-modprobes.patch"))))
310     (build-system gnu-build-system)
311     (arguments
312      `(#:modules
313        ((guix build gnu-build-system)
314         ((guix build go-build-system) #:prefix go:)
315         (guix build union)
316         (guix build utils))
317        #:imported-modules
318        (,@%gnu-build-system-modules
319         (guix build union)
320         (guix build go-build-system))
321        #:phases
322        (modify-phases %standard-phases
323          (add-after 'unpack 'patch-paths
324            (lambda* (#:key inputs #:allow-other-keys)
325              (substitute* "builder/builder-next/executor_unix.go"
326                (("CommandCandidates:.*runc.*")
327                 (string-append "CommandCandidates: []string{\""
328                                (assoc-ref inputs "runc")
329                                "/sbin/runc\"},\n")))
330              (substitute* "vendor/github.com/containerd/go-runc/runc.go"
331                (("DefaultCommand = .*")
332                 (string-append "DefaultCommand = \""
333                                (assoc-ref inputs "runc")
334                                "/sbin/runc\"\n")))
335              (substitute* "vendor/github.com/containerd/containerd/runtime/v1/linux/runtime.go"
336                (("defaultRuntime[ \t]*=.*")
337                 (string-append "defaultRuntime = \""
338                                (assoc-ref inputs "runc")
339                                "/sbin/runc\"\n"))
340                (("defaultShim[ \t]*=.*")
341                 (string-append "defaultShim = \""
342                                (assoc-ref inputs "containerd")
343                                "/bin/containerd-shim\"\n")))
344              (substitute* "daemon/daemon_unix.go"
345                (("DefaultShimBinary = .*")
346                 (string-append "DefaultShimBinary = \""
347                                (assoc-ref inputs "containerd")
348                                "/bin/containerd-shim\"\n"))
349                (("DefaultRuntimeBinary = .*")
350                 (string-append "DefaultRuntimeBinary = \""
351                                (assoc-ref inputs "runc")
352                                "/sbin/runc\"\n"))
353                (("DefaultRuntimeName = .*")
354                 (string-append "DefaultRuntimeName = \""
355                                (assoc-ref inputs "runc")
356                                "/sbin/runc\"\n")))
357              (substitute* "daemon/config/config.go"
358                (("StockRuntimeName = .*")
359                 (string-append "StockRuntimeName = \""
360                                (assoc-ref inputs "runc")
361                                "/sbin/runc\"\n")))
362              (substitute* "vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go"
363                (("var defaultCommandCandidates = .*")
364                 (string-append "var defaultCommandCandidates = []string{\""
365                                (assoc-ref inputs "runc") "/sbin/runc\"}")))
366              (substitute* "vendor/github.com/docker/libnetwork/portmapper/proxy.go"
367                (("var userlandProxyCommandName = .*")
368                 (string-append "var userlandProxyCommandName = \""
369                                (assoc-ref inputs "docker-proxy")
370                                "/bin/proxy\"\n")))
371              (substitute* "pkg/archive/archive.go"
372                (("string\\{\"xz")
373                 (string-append "string{\"" (assoc-ref inputs "xz") "/bin/xz")))
374              (let ((source-files (filter (lambda (name)
375                                            (not (string-contains name "test")))
376                                          (find-files "." "\\.go$"))))
377                (let-syntax ((substitute-LookPath*
378                              (syntax-rules ()
379                                ((_ (source-text package relative-path) ...)
380                                 (substitute* source-files
381                                   (((string-append "\\<exec\\.LookPath\\(\""
382                                                    source-text
383                                                    "\")"))
384                                    (string-append "\""
385                                                   (assoc-ref inputs package)
386                                                   "/" relative-path
387                                                   "\", error(nil)")) ...))))
388                             (substitute-Command*
389                              (syntax-rules ()
390                                ((_ (source-text package relative-path) ...)
391                                 (substitute* source-files
392                                   (((string-append "\\<(re)?exec\\.Command\\(\""
393                                                    source-text
394                                                    "\"") _ re?)
395                                    (string-append (if re? re? "")
396                                                   "exec.Command(\""
397                                                   (assoc-ref inputs package)
398                                                   "/" relative-path
399                                                   "\"")) ...)))))
400                  (substitute-LookPath*
401                   ("ps" "procps" "bin/ps")
402                   ("mkfs.xfs" "xfsprogs" "bin/mkfs.xfs")
403                   ("lvmdiskscan" "lvm2" "sbin/lvmdiskscan")
404                   ("pvdisplay" "lvm2" "sbin/pvdisplay")
405                   ("blkid" "util-linux" "sbin/blkid")
406                   ("unpigz" "pigz" "bin/unpigz")
407                   ("iptables" "iptables" "sbin/iptables")
408                   ("iptables-legacy" "iptables" "sbin/iptables")
409                   ("ip" "iproute2" "sbin/ip"))
411                  (substitute-Command*
412                   ("modprobe" "kmod" "bin/modprobe")
413                   ("pvcreate" "lvm2" "sbin/pvcreate")
414                   ("vgcreate" "lvm2" "sbin/vgcreate")
415                   ("lvcreate" "lvm2" "sbin/lvcreate")
416                   ("lvconvert" "lvm2" "sbin/lvconvert")
417                   ("lvchange" "lvm2" "sbin/lvchange")
418                   ("mkfs.xfs" "xfsprogs" "sbin/mkfs.xfs")
419                   ("xfs_growfs" "xfsprogs" "sbin/xfs_growfs")
420                   ("mkfs.ext4" "e2fsprogs" "sbin/mkfs.ext4")
421                   ("tune2fs" "e2fsprogs" "sbin/tune2fs")
422                   ("blkid" "util-linux" "sbin/blkid")
423                   ("resize2fs" "e2fsprogs" "sbin/resize2fs")
424                   ("ps" "procps" "bin/ps")
425                   ("losetup" "util-linux" "sbin/losetup")
426                   ("uname" "coreutils" "bin/uname")
427                   ("dbus-launch" "dbus" "bin/dbus-launch")
428                   ("git" "git" "bin/git")))
429                ;; docker-mountfrom ??
430                ;; docker
431                ;; docker-untar ??
432                ;; docker-applyLayer ??
433                ;; /usr/bin/uname
434                ;; grep
435                ;; apparmor_parser
437                ;; Make compilation fail when, in future versions, Docker
438                ;; invokes other programs we don't know about and thus don't
439                ;; substitute.
440                (substitute* source-files
441                  ;; Search for Java in PATH.
442                  (("\\<exec\\.Command\\(\"java\"")
443                   "xxec.Command(\"java\"")
444                  ;; Search for AUFS in PATH (mainline Linux doesn't support it).
445                  (("\\<exec\\.Command\\(\"auplink\"")
446                   "xxec.Command(\"auplink\"")
447                  ;; Fail on other unsubstituted commands.
448                  (("\\<exec\\.Command\\(\"([a-zA-Z0-9][a-zA-Z0-9_-]*)\""
449                    _ executable)
450                   (string-append "exec.Guix_doesnt_want_Command(\""
451                                  executable "\""))
452                  (("\\<xxec\\.Command")
453                   "exec.Command")
454                  ;; Search for ZFS in PATH.
455                  (("\\<LookPath\\(\"zfs\"\\)") "LooxPath(\"zfs\")")
456                  ;; Fail on other unsubstituted LookPaths.
457                  (("\\<LookPath\\(\"") "Guix_doesnt_want_LookPath\\(\"")
458                  (("\\<LooxPath") "LookPath")))
459              #t))
460          (add-after 'patch-paths 'delete-failing-tests
461            (lambda _
462              ;; Needs internet access.
463              (delete-file "builder/remotecontext/git/gitutils_test.go")
464              ;; Permission denied.
465              (delete-file "daemon/graphdriver/devmapper/devmapper_test.go")
466              ;; Operation not permitted (idtools.MkdirAllAndChown).
467              (delete-file "daemon/graphdriver/vfs/vfs_test.go")
468              ;; Timeouts after 5 min.
469              (delete-file "plugin/manager_linux_test.go")
470              ;; Operation not permitted.
471              (delete-file "daemon/graphdriver/btrfs/btrfs_test.go")
472              (delete-file "daemon/graphdriver/overlay/overlay_test.go")
473              (delete-file "daemon/graphdriver/overlay2/overlay_test.go")
474              #t))
475          (replace 'configure
476            (lambda _
477              (setenv "DOCKER_GITCOMMIT" (string-append "v" ,%docker-version))
478              ;; Automatically use bundled dependencies.
479              ;; TODO: Unbundle - see file "vendor.conf".
480              (setenv "AUTO_GOPATH" "1")
481              ;; Respectively, strip the symbol table and debug
482              ;; information, and the DWARF symbol table.
483              (setenv "LDFLAGS" "-s -w")
484              ;; Make build faster
485              (setenv "GOCACHE" "/tmp")
486              #t))
487          (add-before 'build 'setup-go-environment
488            (assoc-ref go:%standard-phases 'setup-go-environment))
489          (replace 'build
490            (lambda _
491              ;; Our LD doesn't like the statically linked relocatable things
492              ;; that go produces, so install the dynamic version of
493              ;; dockerd instead.
494              (invoke "hack/make.sh" "dynbinary")))
495          (replace 'check
496            (lambda _
497              ;; The build process generated a file because the environment
498              ;; variable "AUTO_GOPATH" was set.  Use it.
499              (setenv "GOPATH" (string-append (getcwd) "/.gopath"))
500              ;; ".gopath/src/github.com/docker/docker" is a link to the current
501              ;; directory and chdir would canonicalize to that.
502              ;; But go needs to have the uncanonicalized directory name, so
503              ;; store that.
504              (setenv "PWD" (string-append (getcwd)
505                                           "/.gopath/src/github.com/docker/docker"))
506              (with-directory-excursion ".gopath/src/github.com/docker/docker"
507                (invoke "hack/test/unit"))
508              (setenv "PWD" #f)
509              #t))
510          (replace 'install
511            (lambda* (#:key outputs #:allow-other-keys)
512              (let* ((out (assoc-ref outputs "out"))
513                     (out-bin (string-append out "/bin")))
514                (install-file "bundles/dynbinary-daemon/dockerd" out-bin)
515                (install-file "bundles/dynbinary-daemon/dockerd-dev" out-bin)
516                #t))))))
517     (inputs
518      `(("btrfs-progs" ,btrfs-progs)
519        ("containerd" ,containerd)       ; for containerd-shim
520        ("coreutils" ,coreutils)
521        ("dbus" ,dbus)
522        ("docker-proxy" ,docker-libnetwork-cmd-proxy)
523        ("e2fsprogs" ,e2fsprogs)
524        ("git" ,git)
525        ("iproute2" ,iproute)
526        ("iptables" ,iptables)
527        ("kmod" ,kmod)
528        ("libseccomp" ,libseccomp)
529        ("pigz" ,pigz)
530        ("procps" ,procps)
531        ("runc" ,runc)
532        ("util-linux" ,util-linux)
533        ("lvm2" ,lvm2)
534        ("xfsprogs" ,xfsprogs)
535        ("xz" ,xz)))
536     (native-inputs
537      `(("eudev" ,eudev)      ; TODO: Should be propagated by lvm2 (.pc -> .pc)
538        ("go" ,go)
539        ("pkg-config" ,pkg-config)))
540     (synopsis "Docker container component library, and daemon")
541     (description "This package provides a framework to assemble specialized
542 container systems.  It includes components for orchestration, image
543 management, secret management, configuration management, networking,
544 provisioning etc.")
545     (home-page "https://mobyproject.org/")
546     (license license:asl2.0)))
548 (define-public docker-cli
549   (package
550     (name "docker-cli")
551     (version %docker-version)
552     (source
553      (origin
554       (method git-fetch)
555       (uri (git-reference
556             (url "https://github.com/docker/cli.git")
557             (commit (string-append "v" version))))
558       (file-name (git-file-name name version))
559       (sha256
560        (base32 "0mxxjzkwdny8p2dmyjich7x1gn7hdlfppzjy2skk2k5bwv7nxpmi"))))
561     (build-system go-build-system)
562     (arguments
563      `(#:import-path "github.com/docker/cli"
564        ;; TODO: Tests require a running Docker daemon.
565        #:tests? #f
566        #:phases
567        (modify-phases %standard-phases
568          (add-before 'build 'setup-environment-2
569            (lambda _
570              ;; Respectively, strip the symbol table and debug
571              ;; information, and the DWARF symbol table.
572              (setenv "LDFLAGS" "-s -w")
574              ;; Make build reproducible.
575              (setenv "BUILDTIME" "1970-01-01 00:00:01.000000000+00:00")
576              (symlink "src/github.com/docker/cli/scripts" "./scripts")
577              (symlink "src/github.com/docker/cli/docker.Makefile" "./docker.Makefile")
578              #t))
579          (replace 'build
580            (lambda _
581              (invoke "./scripts/build/dynbinary")))
582          (replace 'check
583            (lambda* (#:key make-flags tests? #:allow-other-keys)
584              (setenv "PATH" (string-append (getcwd) "/build:" (getenv "PATH")))
585              (if tests?
586                  ;; Use the newly-built docker client for the tests.
587                  (with-directory-excursion "src/github.com/docker/cli"
588                    ;; TODO: Run test-e2e as well?
589                    (apply invoke "make" "-f" "docker.Makefile" "test-unit"
590                           (or make-flags '())))
591                  #t)))
592          (replace 'install
593            (lambda* (#:key outputs #:allow-other-keys)
594              (let* ((out (assoc-ref outputs "out"))
595                     (out-bin (string-append out "/bin")))
596                (chdir "build")
597                (install-file "docker" out-bin)
598                #t))))))
599     (native-inputs
600      `(("go" ,go)
601        ("libltdl" ,libltdl)
602        ("pkg-config" ,pkg-config)))
603     (synopsis "Command line interface to Docker")
604     (description "This package provides a command line interface to Docker.")
605     (home-page "https://www.docker.com/")
606     (license license:asl2.0)))
608 (define-public cqfd
609   (package
610     (name "cqfd")
611     (version "5.1.0")
612     (source (origin
613               (method git-fetch)
614               (uri (git-reference
615                     (url "https://github.com/savoirfairelinux/cqfd.git")
616                     (commit (string-append "v" version))))
617               (file-name (git-file-name name version))
618               (sha256
619                (base32
620                 "1xhydz01f2rrnw7rmnaxh3f3q1ariq7j2ig0i0w1p3wn10l3q0nv"))))
621     (build-system gnu-build-system)
622     (arguments
623      ;; The test suite requires a docker daemon and connectivity.
624      `(#:tests? #f
625        #:phases
626        (modify-phases %standard-phases
627          (delete 'configure)
628          (delete 'build)
629          (replace 'install
630            (lambda* (#:key outputs #:allow-other-keys)
631              (let ((out (assoc-ref outputs "out")))
632                ;; Fix the directory of the bash completion.
633                (substitute* "Makefile"
634                  (("completionsdir=.*$")
635                   (string-append "completionsdir=" out
636                                  "/etc/bash_completion.d; \\\n")))
637                (invoke "make" "install"
638                        (string-append "PREFIX=" out))))))))
639     (home-page "https://github.com/savoirfairelinux/cqfd")
640     (synopsis "Convenience wrapper for Docker")
641     (description "cqfd is a Bash script that provides a quick and convenient
642 way to run commands in the current directory, but within a Docker container
643 defined in a per-project configuration file.")
644     (license license:gpl3+)))