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