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