3 %bcond_with tests # build without tests
4 %bcond_with vim # build vim syntax package (bundled in vim 7.4.979-2)
5 %bcond_with doc # build manual pages
8 # https://github.com/docker/docker/blob/master/project/PACKAGERS.md#build-dependencies
10 # v1.0.0-rc2-123-gac031b5
11 %define runc_commit ac031b5
13 %define containerd_commit 8517738
15 Summary: Docker: the open-source application container engine
20 Group: Applications/System
21 # https://github.com/docker/docker/releases
22 Source0: https://github.com/docker/docker/archive/v%{version}%{subver}/%{name}-%{version}%{subver}.tar.gz
23 # Source0-md5: 3e40a95c40182314a5c2ba41f5b7d7d2
24 Source1: https://github.com/docker/runc/archive/%{runc_commit}/runc-%{runc_commit}.tar.gz
25 # Source1-md5: 5c22c984bb610dbcd57d11c83125f376
26 Source2: https://github.com/docker/containerd/archive/%{containerd_commit}/containerd-%{containerd_commit}.tar.gz
27 # Source2-md5: f5f0654554164fe3e3433e41955b64f9
30 Source8: %{name}.sysconfig
32 URL: http://www.docker.com/
33 BuildRequires: btrfs-progs-devel >= 3.16.1
34 BuildRequires: device-mapper-devel >= 2.02.89
35 BuildRequires: golang >= 1.6
36 BuildRequires: libseccomp-devel >= 2.2.1
37 BuildRequires: rpmbuild(macros) >= 1.644
38 BuildRequires: sqlite3-devel >= 3.7.9
39 Requires(post,preun): /sbin/chkconfig
40 Requires(postun): /usr/sbin/groupdel
41 Requires(pre): /usr/bin/getgid
42 Requires(pre): /usr/sbin/groupadd
43 Requires: ca-certificates
44 Requires: iproute2 >= 3.5
46 Requires: rc-scripts >= 0.4.0.10
47 Requires: systemd-units >= 38
48 Requires: tar >= 1:1.26
49 Requires: uname(release) >= 3.8
51 Suggests: docker-credential-helpers
52 Suggests: git-core >= 1.7
55 Provides: group(docker)
56 Obsoletes: lxc-docker < 1.1.1
57 # only runs on x64 hosts for now:
58 # https://github.com/docker/docker/issues/136
59 # https://github.com/docker/docker/issues/611
60 ExclusiveArch: %{x8664}
61 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
63 %define bash_compdir %{_datadir}/bash-completion/completions
64 %define zsh_compdir %{_datadir}/zsh/site-functions
65 %define _vimdatadir %{_datadir}/vim
66 %define _libexecdir %{_prefix}/lib
68 # binary stripped or something
69 %define _enable_debug_packages 0
72 Docker is an open source project to pack, ship and run any application
73 as a lightweight container
75 Docker containers are both hardware-agnostic and platform-agnostic.
76 This means that they can run anywhere, from your laptop to the largest
77 EC2 compute instance and everything in between - and they don't
78 require that you use a particular language, framework or packaging
79 system. That makes them great building blocks for deploying and
80 scaling web apps, databases and backend services without depending on
81 a particular stack or provider.
83 Docker is an open-source implementation of the deployment engine which
84 powers dotCloud, a popular Platform-as-a-Service. It benefits directly
85 from the experience accumulated over several years of large-scale
86 operation and support of hundreds of thousands of applications and
89 %package -n bash-completion-%{name}
90 Summary: bash-completion for Docker
91 Summary(pl.UTF-8): bashowe uzupełnianie nazw dla Dockera
92 Group: Applications/Shells
94 Requires: bash-completion >= 2.0
95 Obsoletes: bash-completion-lxc-docker < 1.1.1
96 %if "%{_rpmversion}" >= "5"
100 %description -n bash-completion-%{name}
101 This package provides bash-completion for Docker.
103 %description -n bash-completion-%{name} -l pl.UTF-8
104 Pakiet ten dostarcza bashowe uzupełnianie nazw dla Dockera.
106 %package -n zsh-completion-%{name}
107 Summary: zsh completion for Docker
108 Summary(pl.UTF-8): Uzupełnianie parametrów w zsh dla poleceń Dockera
109 Group: Applications/Shells
111 %if "%{_rpmversion}" >= "5"
115 %description -n zsh-completion-%{name}
116 This package provides zsh completion for Docker.
118 %description -n zsh-completion-%{name} -l pl.UTF-8
119 Pakiet ten dostarcza uzupełnianie w zsh dla poleceń Dockera.
121 %package -n vim-syntax-%{name}
122 Summary: Vim syntax: Docker
123 Group: Applications/Editors/Vim
124 Requires: %{name} = %{version}-%{release}
125 Requires: vim-rt >= 4:7.2.170
126 Obsoletes: vim-syntax-lxc-docker < 1.1.1
127 %if "%{_rpmversion}" >= "5"
131 %description -n vim-syntax-%{name}
132 This plugin provides syntax highlighting in Dockerfile.
135 %setup -q %{?subver:-n %{name}-%{version}%{subver}} -a1 -a2
136 mv runc-%{runc_commit}* runc
137 mv containerd-%{containerd_commit}* containerd
140 install -d vendor/src/github.com/docker
141 ln -s $(pwd) vendor/src/github.com/docker/docker
142 ln -s $(pwd)/containerd containerd/vendor/src/github.com/docker/containerd
145 v=$(awk -F= '/RUNC_COMMIT/ {print $2}' hack/dockerfile/binaries-commits)
146 echo "$v" | grep "^%{runc_commit}"
147 v=$(awk -F= '/CONTAINERD_COMMIT/ {print $2}' hack/dockerfile/binaries-commits)
148 echo "$v" | grep "^%{containerd_commit}"
150 export GOPATH=$(pwd)/vendor:$(pwd)/containerd/vendor
151 export DOCKER_GITCOMMIT="pld/%{version}"
156 # build docker-containerd
157 %{__make} -C containerd
159 bash -x hack/make.sh dynbinary
165 rm -rf $RPM_BUILD_ROOT
166 install -d $RPM_BUILD_ROOT{%{_bindir},%{_sbindir},%{_mandir}/man1,/etc/{rc.d/init.d,sysconfig},%{systemdunitdir}} \
167 $RPM_BUILD_ROOT%{_libexecdir} \
168 $RPM_BUILD_ROOT/var/lib/docker/{containers,execdriver,graph,image,init,network,swarm,tmp,trust,vfs,volumes}
170 install -p bundles/%{version}%{?subver}/dynbinary-client/docker-%{version}%{?subver} $RPM_BUILD_ROOT%{_bindir}/docker
171 install -p bundles/%{version}%{?subver}/dynbinary-daemon/docker-proxy-%{version}%{?subver} $RPM_BUILD_ROOT%{_sbindir}/docker-proxy
172 install -p bundles/%{version}%{?subver}/dynbinary-daemon/dockerd-%{version}%{?subver} $RPM_BUILD_ROOT%{_sbindir}/dockerd
174 # install docker-runc
175 install -p runc/runc $RPM_BUILD_ROOT%{_sbindir}/docker-runc
177 # install docker-containerd
178 install -p containerd/bin/containerd $RPM_BUILD_ROOT%{_sbindir}/docker-containerd
179 install -p containerd/bin/containerd-shim $RPM_BUILD_ROOT%{_sbindir}/docker-containerd-shim
180 install -p containerd/bin/ctr $RPM_BUILD_ROOT%{_sbindir}/docker-containerd-ctr
182 cp -p contrib/init/systemd/docker.service $RPM_BUILD_ROOT%{systemdunitdir}
183 cp -p contrib/init/systemd/docker.socket $RPM_BUILD_ROOT%{systemdunitdir}
184 install -p %{SOURCE7} $RPM_BUILD_ROOT/etc/rc.d/init.d/docker
185 install -p %{SOURCE4} $RPM_BUILD_ROOT%{_libexecdir}/dockerd
186 cp -p %{SOURCE8} $RPM_BUILD_ROOT/etc/sysconfig/docker
189 install -d $RPM_BUILD_ROOT/lib/udev/rules.d
190 cp -p contrib/udev/80-docker.rules $RPM_BUILD_ROOT/lib/udev/rules.d
192 # bash and zsh completion
193 install -d $RPM_BUILD_ROOT%{bash_compdir}
194 cp -p contrib/completion/bash/docker $RPM_BUILD_ROOT%{bash_compdir}/docker
195 install -d $RPM_BUILD_ROOT%{zsh_compdir}
196 cp -p contrib/completion/zsh/_docker $RPM_BUILD_ROOT%{zsh_compdir}
200 install -d $RPM_BUILD_ROOT%{_vimdatadir}
201 cp -a contrib/syntax/vim/* $RPM_BUILD_ROOT%{_vimdatadir}
202 %{__rm} $RPM_BUILD_ROOT%{_vimdatadir}/{LICENSE,README.md}
206 %groupadd -g 296 docker
209 /sbin/chkconfig --add %{name}
210 %service -n %{name} restart
211 %systemd_post %{name}.service
214 if [ "$1" = "0" ]; then
215 %service -q %{name} stop
216 /sbin/chkconfig --del %{name}
218 %systemd_preun %{name}.service
221 if [ "$1" = "0" ]; then
227 rm -rf $RPM_BUILD_ROOT
230 %defattr(644,root,root,755)
231 %doc README.md CHANGELOG.md CONTRIBUTING.md LICENSE AUTHORS NOTICE MAINTAINERS
232 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/docker
233 %attr(754,root,root) /etc/rc.d/init.d/docker
234 %attr(755,root,root) %{_bindir}/docker
235 %attr(755,root,root) %{_sbindir}/docker-containerd
236 %attr(755,root,root) %{_sbindir}/docker-containerd-ctr
237 %attr(755,root,root) %{_sbindir}/docker-containerd-shim
238 %attr(755,root,root) %{_sbindir}/docker-proxy
239 %attr(755,root,root) %{_sbindir}/docker-runc
240 %attr(755,root,root) %{_sbindir}/dockerd
241 %attr(755,root,root) %{_libexecdir}/dockerd
242 %{systemdunitdir}/docker.service
243 %{systemdunitdir}/docker.socket
244 /lib/udev/rules.d/80-docker.rules
246 %dir %attr(700,root,root) /var/lib/docker
247 %dir %attr(700,root,root) /var/lib/docker/containers
248 %dir %attr(700,root,root) /var/lib/docker/execdriver
249 %dir %attr(700,root,root) /var/lib/docker/graph
250 %dir %attr(700,root,root) /var/lib/docker/image
251 %dir %attr(700,root,root) /var/lib/docker/init
252 %dir %attr(700,root,root) /var/lib/docker/network
253 %dir %attr(700,root,root) /var/lib/docker/swarm
254 %dir %attr(700,root,root) /var/lib/docker/tmp
255 %dir %attr(700,root,root) /var/lib/docker/trust
256 %dir %attr(700,root,root) /var/lib/docker/vfs
257 %dir %attr(700,root,root) /var/lib/docker/volumes
259 %files -n bash-completion-%{name}
260 %defattr(644,root,root,755)
261 %{bash_compdir}/docker
263 %files -n zsh-completion-%{name}
264 %defattr(644,root,root,755)
265 %{zsh_compdir}/_docker
268 %files -n vim-syntax-%{name}
269 %defattr(644,root,root,755)
270 %doc contrib/syntax/vim/{README.md,LICENSE}
271 %{_vimdatadir}/doc/dockerfile.txt
272 %{_vimdatadir}/ftdetect/dockerfile.vim
273 %{_vimdatadir}/syntax/dockerfile.vim