Commit | Line | Data |
---|---|---|
d020bfc2 DT |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2016 David Thompson <davet@gnu.org> | |
42531fd3 | 3 | ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il> |
d020bfc2 DT |
4 | ;;; |
5 | ;;; This file is part of GNU Guix. | |
6 | ;;; | |
7 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
8 | ;;; under the terms of the GNU General Public License as published by | |
9 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
10 | ;;; your option) any later version. | |
11 | ;;; | |
12 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
13 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | ;;; GNU General Public License for more details. | |
16 | ;;; | |
17 | ;;; You should have received a copy of the GNU General Public License | |
18 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
19 | ||
20 | (define-module (gnu packages docker) | |
21 | #:use-module ((guix licenses) #:prefix license:) | |
22 | #:use-module (gnu packages) | |
23 | #:use-module (guix packages) | |
24 | #:use-module (guix download) | |
25 | #:use-module (guix git-download) | |
f87ea24a | 26 | #:use-module (guix build-system gnu) |
4e5b8f72 | 27 | #:use-module (guix build-system go) |
d020bfc2 DT |
28 | #:use-module (guix build-system python) |
29 | #:use-module (guix utils) | |
e9b31645 | 30 | #:use-module (gnu packages autotools) |
58adcaa1 | 31 | #:use-module (gnu packages base) |
42531fd3 | 32 | #:use-module (gnu packages check) |
f87ea24a | 33 | #:use-module (gnu packages compression) |
6b6a25d4 | 34 | #:use-module (gnu packages glib) |
4e5b8f72 DM |
35 | #:use-module (gnu packages golang) |
36 | #:use-module (gnu packages linux) | |
37 | #:use-module (gnu packages pkg-config) | |
1b2f753d | 38 | #:use-module (gnu packages python) |
1f1e338a | 39 | #:use-module (gnu packages python-web) |
6b6a25d4 | 40 | #:use-module (gnu packages version-control) |
1f1e338a | 41 | #:use-module (gnu packages virtualization)) |
d020bfc2 | 42 | |
f87ea24a DM |
43 | (define %docker-version "18.09.0") |
44 | ||
d020bfc2 DT |
45 | (define-public python-docker-py |
46 | (package | |
47 | (name "python-docker-py") | |
b24da117 | 48 | (version "1.10.6") |
d020bfc2 DT |
49 | (source |
50 | (origin | |
51 | (method url-fetch) | |
52 | (uri (pypi-uri "docker-py" version)) | |
53 | (sha256 | |
54 | (base32 | |
b24da117 | 55 | "05f49f6hnl7npmi7kigg0ibqk8s3fhzx1ivvz1kqvlv4ay3paajc")))) |
d020bfc2 DT |
56 | (build-system python-build-system) |
57 | ;; TODO: Tests require a running Docker daemon. | |
58 | (arguments '(#:tests? #f)) | |
59 | (inputs | |
60 | `(("python-requests" ,python-requests) | |
d020bfc2 DT |
61 | ("python-six" ,python-six) |
62 | ("python-websocket-client" ,python-websocket-client))) | |
63 | (home-page "https://github.com/docker/docker-py/") | |
64 | (synopsis "Python client for Docker") | |
65 | (description "Docker-Py is a Python client for the Docker container | |
66 | management tool.") | |
67 | (license license:asl2.0))) | |
b42c9c81 DT |
68 | |
69 | (define-public python-dockerpty | |
70 | (package | |
71 | (name "python-dockerpty") | |
72 | (version "0.3.4") | |
73 | (source | |
74 | (origin | |
75 | (method url-fetch) | |
76 | (uri (pypi-uri "dockerpty" version)) | |
77 | (sha256 | |
78 | (base32 | |
79 | "0za6rr349641wv76ww9l3zcic2xyxrirlxpnzl4296h897648455")))) | |
80 | (build-system python-build-system) | |
81 | (native-inputs | |
82 | `(("python-six" ,python-six))) | |
83 | (home-page "https://github.com/d11wtq/dockerpty") | |
84 | (synopsis "Python library to use the pseudo-TTY of a Docker container") | |
85 | (description "Docker PTY provides the functionality needed to operate the | |
86 | pseudo-terminal (PTY) allocated to a Docker container using the Python | |
87 | client.") | |
88 | (license license:asl2.0))) | |
df1f1d69 DT |
89 | |
90 | (define-public docker-compose | |
91 | (package | |
92 | (name "docker-compose") | |
93 | (version "1.5.2") | |
94 | (source | |
95 | (origin | |
96 | (method url-fetch) | |
97 | (uri (pypi-uri "docker-compose" version)) | |
98 | (sha256 | |
99 | (base32 | |
100 | "0ksg7hm2yvc977968dixxisrhcmvskzpcx3pz0v1kazrdqp7xakr")))) | |
101 | (build-system python-build-system) | |
102 | ;; TODO: Tests require running Docker daemon. | |
103 | (arguments '(#:tests? #f)) | |
104 | (inputs | |
105 | `(("python-docker-py" ,python-docker-py) | |
106 | ("python-dockerpty" ,python-dockerpty) | |
107 | ("python-docopt" ,python-docopt) | |
df1f1d69 DT |
108 | ("python-jsonschema" ,python-jsonschema) |
109 | ("python-pyyaml" ,python-pyyaml) | |
110 | ("python-requests" ,python-requests-2.7) | |
df1f1d69 DT |
111 | ("python-six" ,python-six) |
112 | ("python-texttable" ,python-texttable) | |
113 | ("python-websocket-client" ,python-websocket-client))) | |
114 | (home-page "https://www.docker.com/") | |
115 | (synopsis "Multi-container orchestration for Docker") | |
116 | (description "Docker Compose is a tool for defining and running | |
117 | multi-container Docker applications. A Compose file is used to configure an | |
118 | application’s services. Then, using a single command, the containers are | |
119 | created and all the services are started as specified in the configuration.") | |
120 | (license license:asl2.0))) | |
42531fd3 EF |
121 | |
122 | (define-public python-docker-pycreds | |
123 | (package | |
124 | (name "python-docker-pycreds") | |
125 | (version "0.3.0") | |
126 | (source | |
127 | (origin | |
128 | (method url-fetch) | |
129 | (uri (pypi-uri "docker-pycreds" version)) | |
130 | (sha256 | |
131 | (base32 | |
132 | "1zxvam1q22qb0jf48553nnncnfrcp88ag4xa0qmq6vr0imn9a3lb")))) | |
133 | (build-system python-build-system) | |
134 | (arguments | |
135 | `(#:phases | |
136 | (modify-phases %standard-phases | |
137 | (add-after 'unpack 'fix-versioning | |
138 | (lambda _ | |
139 | (substitute* "test-requirements.txt" | |
140 | (("3.0.2") ,(package-version python-pytest)) | |
141 | (("2.3.1") ,(package-version python-pytest-cov)) | |
142 | (("2.4.1") ,(package-version python-flake8))) | |
143 | #t))))) | |
144 | (native-inputs | |
145 | `(("python-flake8" ,python-flake8) | |
146 | ("python-pytest" ,python-pytest) | |
147 | ("python-pytest-cov" ,python-pytest-cov))) | |
148 | (propagated-inputs | |
149 | `(("python-six" ,python-six))) | |
150 | (home-page "https://github.com/shin-/dockerpy-creds") | |
151 | (synopsis | |
152 | "Python bindings for the Docker credentials store API") | |
153 | (description | |
154 | "Docker-Pycreds contains the Python bindings for the docker credentials | |
155 | store API. It allows programmers to interact with a Docker registry using | |
156 | Python without keeping their credentials in a Docker configuration file.") | |
157 | (license license:asl2.0))) | |
4e5b8f72 DM |
158 | |
159 | (define-public containerd | |
160 | (package | |
161 | (name "containerd") | |
162 | (version "1.2.1") | |
163 | (source | |
164 | (origin | |
165 | (method git-fetch) | |
166 | (uri (git-reference | |
167 | (url "https://github.com/containerd/containerd.git") | |
168 | (commit (string-append "v" version)))) | |
169 | (file-name (git-file-name name version)) | |
170 | (sha256 | |
171 | (base32 | |
172 | "16zn6p1ky3yrgn53z8h9wza53ch91fj47wj5xgz6w4c57j30f66p")))) | |
173 | (build-system go-build-system) | |
174 | (arguments | |
175 | `(#:import-path "github.com/containerd/containerd" | |
4e5b8f72 DM |
176 | #:phases |
177 | (modify-phases %standard-phases | |
178 | (add-before 'build 'chdir | |
179 | (lambda _ | |
180 | (chdir "src/github.com/containerd/containerd") | |
181 | #t)) | |
182 | (add-after 'chdir 'patch-paths | |
183 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
184 | ;; TODO: Patch "socat", "unpigz". | |
185 | (substitute* "./runtime/v1/linux/runtime.go" | |
186 | (("defaultRuntime[ \t]*=.*") | |
187 | (string-append "defaultRuntime = \"" | |
188 | (assoc-ref inputs "runc") | |
189 | "/sbin/runc\"\n")) | |
190 | (("defaultShim[ \t]*=.*") | |
191 | (string-append "defaultShim = \"" | |
192 | (assoc-ref outputs "out") | |
193 | "/bin/containerd-shim\"\n"))) | |
194 | (substitute* "./vendor/github.com/containerd/go-runc/runc.go" | |
195 | (("DefaultCommand[ \t]*=.*") | |
196 | (string-append "DefaultCommand = \"" | |
197 | (assoc-ref inputs "runc") | |
198 | "/sbin/runc\"\n"))) | |
8b487bf8 DM |
199 | (substitute* "vendor/github.com/containerd/continuity/testutil/loopback/loopback_linux.go" |
200 | (("exec\\.Command\\(\"losetup\"") ; ) | |
201 | (string-append "exec.Command(\"" | |
202 | (assoc-ref inputs "util-linux") | |
203 | "/sbin/losetup\""))) ;) | |
4e5b8f72 DM |
204 | #t)) |
205 | (replace 'build | |
206 | (lambda* (#:key (make-flags '()) #:allow-other-keys) | |
207 | (apply invoke "make" make-flags))) | |
208 | (replace 'install | |
209 | (lambda* (#:key outputs (make-flags '()) #:allow-other-keys) | |
210 | (let* ((out (assoc-ref outputs "out"))) | |
211 | (apply invoke "make" (string-append "DESTDIR=" out) "install" | |
212 | make-flags))))))) | |
213 | (inputs | |
214 | `(("btrfs-progs" ,btrfs-progs) | |
215 | ("libseccomp" ,libseccomp) | |
8b487bf8 DM |
216 | ("runc" ,runc) |
217 | ("util-linux" ,util-linux))) | |
4e5b8f72 DM |
218 | (native-inputs |
219 | `(("go" ,go) | |
220 | ("pkg-config" ,pkg-config))) | |
40c7476a | 221 | (synopsis "Docker container runtime") |
4e5b8f72 DM |
222 | (description "This package provides the container daemon for Docker. |
223 | It includes image transfer and storage, container execution and supervision, | |
224 | network attachments.") | |
225 | (home-page "http://containerd.io/") | |
226 | (license license:asl2.0))) | |
f87ea24a DM |
227 | |
228 | (define-public docker | |
229 | (package | |
230 | (name "docker") | |
231 | (version %docker-version) | |
232 | (source | |
233 | (origin | |
234 | (method git-fetch) | |
235 | (uri (git-reference | |
236 | (url "https://github.com/docker/engine.git") | |
237 | (commit (string-append "v" version)))) | |
238 | (file-name (git-file-name name version)) | |
239 | (sha256 | |
240 | (base32 | |
241 | "1liqbx58grqih6m8hz9y20y5waflv19pv15l3wl64skap2bsn21c")) | |
242 | (patches | |
243 | (search-patches "docker-engine-test-noinstall.patch" | |
244 | "docker-fix-tests.patch")))) | |
245 | (build-system gnu-build-system) | |
246 | (arguments | |
247 | `(#:modules | |
248 | ((guix build gnu-build-system) | |
249 | ((guix build go-build-system) #:prefix go:) | |
250 | (guix build utils)) | |
251 | #:imported-modules | |
252 | (,@%gnu-build-system-modules | |
253 | (guix build go-build-system)) | |
254 | #:phases | |
255 | (modify-phases %standard-phases | |
256 | (add-after 'unpack 'patch-paths | |
257 | (lambda* (#:key inputs #:allow-other-keys) | |
258 | (substitute* "builder/builder-next/executor_unix.go" | |
259 | (("CommandCandidates:.*runc.*") | |
260 | (string-append "CommandCandidates: []string{\"" | |
261 | (assoc-ref inputs "runc") | |
262 | "/sbin/runc\"},\n"))) | |
263 | (substitute* "vendor/github.com/containerd/go-runc/runc.go" | |
264 | (("DefaultCommand = .*") | |
265 | (string-append "DefaultCommand = \"" | |
266 | (assoc-ref inputs "runc") | |
267 | "/sbin/runc\"\n"))) | |
268 | (substitute* "vendor/github.com/containerd/containerd/runtime/v1/linux/runtime.go" | |
269 | (("defaultRuntime[ \t]*=.*") | |
270 | (string-append "defaultRuntime = \"" | |
271 | (assoc-ref inputs "runc") | |
272 | "/sbin/runc\"\n")) | |
273 | (("defaultShim[ \t]*=.*") | |
274 | (string-append "defaultShim = \"" | |
275 | (assoc-ref inputs "containerd") | |
276 | "/bin/containerd-shim\"\n"))) | |
277 | (substitute* "daemon/daemon_unix.go" | |
278 | (("DefaultShimBinary = .*") | |
279 | (string-append "DefaultShimBinary = \"" | |
280 | (assoc-ref inputs "containerd") | |
281 | "/bin/containerd-shim\"\n")) | |
282 | (("DefaultRuntimeBinary = .*") | |
283 | (string-append "DefaultRuntimeBinary = \"" | |
284 | (assoc-ref inputs "runc") | |
285 | "/sbin/runc\"\n")) | |
286 | (("DefaultRuntimeName = .*") | |
287 | (string-append "DefaultRuntimeName = \"" | |
288 | (assoc-ref inputs "runc") | |
289 | "/sbin/runc\"\n"))) | |
290 | (substitute* "daemon/config/config.go" | |
291 | (("StockRuntimeName = .*") | |
292 | (string-append "StockRuntimeName = \"" | |
293 | (assoc-ref inputs "runc") | |
294 | "/sbin/runc\"\n"))) | |
295 | (substitute* "vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go" | |
296 | (("var defaultCommandCandidates = .*") | |
297 | (string-append "var defaultCommandCandidates = []string{\"" | |
298 | (assoc-ref inputs "runc") "/sbin/runc\"}"))) | |
299 | (let ((source-files (filter (lambda (name) | |
300 | (not (string-contains name "test"))) | |
301 | (find-files "." "\\.go$")))) | |
302 | (let-syntax ((substitute-LookPath | |
303 | (lambda (x) | |
304 | (syntax-case x () | |
305 | ((substitute-LookPath source-text package | |
306 | relative-path) | |
307 | #`(substitute* source-files | |
308 | ((#,(string-append "exec\\.LookPath\\(\"" | |
309 | (syntax->datum | |
310 | #'source-text) | |
311 | "\")")) | |
312 | (string-append "\"" | |
313 | (assoc-ref inputs package) | |
314 | relative-path | |
58adcaa1 DM |
315 | "\", error(nil)"))))))) |
316 | (substitute-Command | |
317 | (lambda (x) | |
318 | (syntax-case x () | |
319 | ((substitute-LookPath source-text package | |
320 | relative-path) | |
321 | #`(substitute* source-files | |
322 | ((#,(string-append "exec\\.Command\\(\"" | |
323 | (syntax->datum | |
324 | #'source-text) | |
325 | "\"")) ; ) | |
326 | (string-append "exec.Command(\"" | |
327 | (assoc-ref inputs package) | |
328 | relative-path | |
329 | "\"")))))))) ; ) | |
f87ea24a DM |
330 | (substitute-LookPath "ps" "procps" "/bin/ps") |
331 | (substitute-LookPath "mkfs.xfs" "xfsprogs" "/bin/mkfs.xfs") | |
332 | (substitute-LookPath "lvmdiskscan" "lvm2" "/sbin/lvmdiskscan") | |
333 | (substitute-LookPath "pvdisplay" "lvm2" "/sbin/pvdisplay") | |
334 | (substitute-LookPath "blkid" "util-linux" "/sbin/blkid") | |
335 | (substitute-LookPath "unpigz" "pigz" "/bin/unpigz") | |
336 | (substitute-LookPath "iptables" "iptables" "/sbin/iptables") | |
58adcaa1 DM |
337 | (substitute-LookPath "ip" "iproute2" "/sbin/ip") |
338 | (substitute-Command "modprobe" "kmod" "/bin/modprobe") | |
339 | (substitute-Command "pvcreate" "lvm2" "/sbin/pvcreate") | |
340 | (substitute-Command "vgcreate" "lvm2" "/sbin/vgcreate") | |
341 | (substitute-Command "lvcreate" "lvm2" "/sbin/lvcreate") | |
342 | (substitute-Command "lvconvert" "lvm2" "/sbin/lvconvert") | |
343 | (substitute-Command "lvchange" "lvm2" "/sbin/lvchange") | |
344 | (substitute-Command "mkfs.xfs" "xfsprogs" "/sbin/mkfs.xfs") | |
345 | (substitute-Command "xfs_growfs" "xfsprogs" "/sbin/xfs_growfs") | |
346 | (substitute-Command "mkfs.ext4" "e2fsprogs" "/sbin/mkfs.ext4") | |
347 | (substitute-Command "tune2fs" "e2fsprogs" "/sbin/tune2fs") | |
348 | (substitute-Command "blkid" "util-linux" "/sbin/blkid") | |
349 | (substitute-Command "resize2fs" "e2fsprogs" "/sbin/resize2fs") | |
350 | ; docker-mountfrom ?? | |
351 | ; docker | |
6b6a25d4 DM |
352 | ; docker-untar ?? |
353 | ; docker-applyLayer ?? | |
58adcaa1 | 354 | ; /usr/bin/uname |
58adcaa1 DM |
355 | ; grep |
356 | ; apparmor_parser | |
357 | (substitute-Command "ps" "procps" "/bin/ps") | |
358 | (substitute-Command "losetup" "util-linux" "/sbin/losetup") | |
6b6a25d4 DM |
359 | (substitute-Command "uname" "coreutils" "/bin/uname") |
360 | (substitute-Command "dbus-launch" "dbus" "/bin/dbus-launch") | |
361 | (substitute-Command "git" "git" "/bin/git")) | |
65a7e35c DM |
362 | ;; Make compilation fail when, in future versions, Docker |
363 | ;; invokes other programs we don't know about and thus don't | |
364 | ;; substitute. | |
365 | (substitute* source-files | |
ffcd2827 DM |
366 | ;; Search for Java in PATH. |
367 | (("\\<exec\\.Command\\(\"java\"") ; ) | |
368 | "xxec.Command(\"java\"") ; ) | |
369 | ;; Search for AUFS in PATH (mainline Linux doesn't support it). | |
370 | (("\\<exec\\.Command\\(\"auplink\"") ; ) | |
371 | "xxec.Command(\"auplink\"") ; ) | |
372 | ;; Fail on other unsubstituted commands. | |
373 | (("\\<exec\\.Command\\(\"([a-zA-Z0-9][a-zA-Z0-9_-]*)\"" | |
374 | _ executable) ; ) | |
375 | (string-append "exec.Guix_doesnt_want_Command(\"" | |
376 | executable "\"")) ;) | |
377 | (("\\<xxec\\.Command") | |
378 | "exec.Command") | |
379 | ;; Search for ZFS in PATH. | |
380 | (("\\<LookPath\\(\"zfs\"\\)") "LooxPath(\"zfs\")") | |
381 | ;; Fail on other unsubstituted LookPaths. | |
382 | (("\\<LookPath\\(\"") "Guix_doesnt_want_LookPath\\(\"") ; )) | |
383 | (("\\<LooxPath") "LookPath"))) | |
f87ea24a DM |
384 | #t)) |
385 | (add-after 'patch-paths 'delete-failing-tests | |
386 | (lambda _ | |
387 | ;; Needs internet access. | |
388 | (delete-file "builder/remotecontext/git/gitutils_test.go") | |
389 | ;; Permission denied. | |
390 | (delete-file "daemon/graphdriver/devmapper/devmapper_test.go") | |
391 | ;; Operation not permitted (idtools.MkdirAllAndChown). | |
392 | (delete-file "daemon/graphdriver/vfs/vfs_test.go") | |
393 | ;; Timeouts after 5 min. | |
394 | (delete-file "plugin/manager_linux_test.go") | |
8cd95860 DM |
395 | ;; Operation not permitted. |
396 | (delete-file "daemon/graphdriver/overlay/overlay_test.go") | |
397 | (delete-file "daemon/graphdriver/overlay2/overlay_test.go") | |
f87ea24a DM |
398 | #t)) |
399 | (replace 'configure | |
400 | (lambda _ | |
401 | (setenv "DOCKER_GITCOMMIT" (string-append "v" ,%docker-version)) | |
402 | ;; Automatically use bundled dependencies. | |
403 | ;; TODO: Unbundle - see file "vendor.conf". | |
404 | (setenv "AUTO_GOPATH" "1") | |
405 | ;; Respectively, strip the symbol table and debug | |
406 | ;; information, and the DWARF symbol table. | |
407 | (setenv "LDFLAGS" "-s -w") | |
408 | ;; Make build faster | |
409 | (setenv "GOCACHE" "/tmp") | |
410 | #t)) | |
411 | (add-before 'build 'setup-environment | |
412 | (assoc-ref go:%standard-phases 'setup-environment)) | |
413 | (replace 'build | |
414 | (lambda _ | |
415 | ;; Our LD doesn't like the statically linked relocatable things | |
416 | ;; that go produces, so install the dynamic version of | |
417 | ;; dockerd instead. | |
418 | (invoke "hack/make.sh" "dynbinary"))) | |
419 | (replace 'check | |
420 | (lambda _ | |
421 | ;; The build process generated a file because the environment | |
422 | ;; variable "AUTO_GOPATH" was set. Use it. | |
423 | (setenv "GOPATH" (string-append (getcwd) "/.gopath")) | |
424 | ;; ".gopath/src/github.com/docker/docker" is a link to the current | |
425 | ;; directory and chdir would canonicalize to that. | |
426 | ;; But go needs to have the uncanonicalized directory name, so | |
427 | ;; store that. | |
428 | (setenv "PWD" (string-append (getcwd) | |
429 | "/.gopath/src/github.com/docker/docker")) | |
430 | (with-directory-excursion ".gopath/src/github.com/docker/docker" | |
431 | (invoke "hack/test/unit")) | |
432 | (setenv "PWD" #f) | |
433 | #t)) | |
434 | (replace 'install | |
435 | (lambda* (#:key outputs #:allow-other-keys) | |
436 | (let* ((out (assoc-ref outputs "out")) | |
437 | (out-bin (string-append out "/bin"))) | |
438 | (install-file "bundles/dynbinary-daemon/dockerd" out-bin) | |
439 | (install-file "bundles/dynbinary-daemon/dockerd-dev" out-bin) | |
440 | #t)))))) | |
441 | (inputs | |
442 | `(("btrfs-progs" ,btrfs-progs) | |
443 | ("containerd" ,containerd) ; for containerd-shim | |
58adcaa1 | 444 | ("coreutils" ,coreutils) |
6b6a25d4 | 445 | ("dbus" ,dbus) |
58adcaa1 | 446 | ("e2fsprogs" ,e2fsprogs) |
6b6a25d4 | 447 | ("git" ,git) |
f87ea24a DM |
448 | ("iproute2" ,iproute) |
449 | ("iptables" ,iptables) | |
58adcaa1 | 450 | ("kmod" ,kmod) |
f87ea24a DM |
451 | ("libseccomp" ,libseccomp) |
452 | ("pigz" ,pigz) | |
453 | ("procps" ,procps) | |
58adcaa1 | 454 | ("runc" ,runc) |
f87ea24a DM |
455 | ("util-linux" ,util-linux) |
456 | ("lvm2" ,lvm2) | |
457 | ("xfsprogs" ,xfsprogs))) | |
458 | (native-inputs | |
459 | `(("eudev" ,eudev) ; TODO: Should be propagated by lvm2 (.pc -> .pc) | |
460 | ("go" ,go) | |
461 | ("pkg-config" ,pkg-config))) | |
462 | (synopsis "Docker container component library, and daemon") | |
463 | (description "This package provides a framework to assemble specialized | |
464 | container systems. It includes components for orchestration, image | |
465 | management, secret management, configuration management, networking, | |
466 | provisioning etc.") | |
467 | (home-page "https://mobyproject.org/") | |
468 | (license license:asl2.0))) | |
e9b31645 DM |
469 | |
470 | (define-public docker-cli | |
471 | (package | |
472 | (name "docker-cli") | |
473 | (version %docker-version) | |
474 | (source | |
475 | (origin | |
476 | (method git-fetch) | |
477 | (uri (git-reference | |
478 | (url "https://github.com/docker/cli.git") | |
479 | (commit (string-append "v" version)))) | |
480 | (file-name (git-file-name name version)) | |
481 | (sha256 | |
482 | (base32 | |
483 | "1ivisys20kphvbqlazc3bsg7pk0ykj9gjx5d4yg439x4n13jxwvb")))) | |
484 | (build-system go-build-system) | |
485 | (arguments | |
486 | `(#:import-path "github.com/docker/cli" | |
487 | ;; TODO: Tests require a running Docker daemon. | |
488 | #:tests? #f | |
489 | #:phases | |
490 | (modify-phases %standard-phases | |
491 | (add-before 'build 'setup-environment-2 | |
492 | (lambda _ | |
493 | ;; Respectively, strip the symbol table and debug | |
494 | ;; information, and the DWARF symbol table. | |
495 | (setenv "LDFLAGS" "-s -w") | |
496 | ||
497 | ;; Make build reproducible. | |
498 | (setenv "BUILDTIME" "1970-01-01 00:00:01.000000000+00:00") | |
499 | (symlink "src/github.com/docker/cli/scripts" "./scripts") | |
500 | (symlink "src/github.com/docker/cli/docker.Makefile" "./docker.Makefile") | |
501 | #t)) | |
502 | (replace 'build | |
503 | (lambda _ | |
504 | (invoke "./scripts/build/dynbinary"))) | |
505 | (replace 'check | |
506 | (lambda* (#:key make-flags tests? #:allow-other-keys) | |
507 | (setenv "PATH" (string-append (getcwd) "/build:" (getenv "PATH"))) | |
508 | (if tests? | |
509 | ;; Use the newly-built docker client for the tests. | |
510 | (with-directory-excursion "src/github.com/docker/cli" | |
511 | ;; TODO: Run test-e2e as well? | |
512 | (apply invoke "make" "-f" "docker.Makefile" "test-unit" | |
513 | (or make-flags '()))) | |
514 | #t))) | |
515 | (replace 'install | |
516 | (lambda* (#:key outputs #:allow-other-keys) | |
517 | (let* ((out (assoc-ref outputs "out")) | |
518 | (out-bin (string-append out "/bin"))) | |
519 | (chdir "build") | |
e9b31645 DM |
520 | (install-file "docker" out-bin) |
521 | #t)))))) | |
522 | (native-inputs | |
523 | `(("go" ,go) | |
524 | ("libltdl" ,libltdl) | |
525 | ("pkg-config" ,pkg-config))) | |
526 | (synopsis "Command line interface to Docker") | |
527 | (description "This package provides a command line interface to Docker.") | |
528 | (home-page "http://www.docker.com/") | |
529 | (license license:asl2.0))) |