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-rc1-39-gcc29e3d
11 %define runc_commit cc29e3d
13 %define containerd_commit 0ac3cd1
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}/%{name}-%{version}.tar.gz
23 # Source0-md5: 7af7b4c25d414aa19bc7382bd85c25f7
24 Source1: https://github.com/opencontainers/runc/archive/%{runc_commit}/runc-%{runc_commit}.tar.gz
25 # Source1-md5: 716d0b284ce42490eeb83befba10fafb
26 Source2: https://github.com/docker/containerd/archive/%{containerd_commit}/containerd-%{containerd_commit}.tar.gz
27 # Source2-md5: f0a0c1101ad259b84fb457c8c7036723
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: iproute2 >= 3.5
45 Requires: rc-scripts >= 0.4.0.10
46 Requires: systemd-units >= 38
47 Requires: tar >= 1:1.26
48 Requires: uname(release) >= 3.8
50 Suggests: docker-credential-helpers
51 Suggests: git-core >= 1.7
54 Provides: group(docker)
55 Obsoletes: lxc-docker < 1.1.1
56 # only runs on x64 hosts for now:
57 # https://github.com/docker/docker/issues/136
58 # https://github.com/docker/docker/issues/611
59 ExclusiveArch: %{x8664}
60 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
62 %define bash_compdir %{_datadir}/bash-completion/completions
63 %define zsh_compdir %{_datadir}/zsh/site-functions
64 %define _vimdatadir %{_datadir}/vim
65 %define _libexecdir %{_prefix}/lib
67 # binary stripped or something
68 %define _enable_debug_packages 0
71 Docker is an open source project to pack, ship and run any application
72 as a lightweight container
74 Docker containers are both hardware-agnostic and platform-agnostic.
75 This means that they can run anywhere, from your laptop to the largest
76 EC2 compute instance and everything in between - and they don't
77 require that you use a particular language, framework or packaging
78 system. That makes them great building blocks for deploying and
79 scaling web apps, databases and backend services without depending on
80 a particular stack or provider.
82 Docker is an open-source implementation of the deployment engine which
83 powers dotCloud, a popular Platform-as-a-Service. It benefits directly
84 from the experience accumulated over several years of large-scale
85 operation and support of hundreds of thousands of applications and
88 %package -n bash-completion-%{name}
89 Summary: bash-completion for Docker
90 Summary(pl.UTF-8): bashowe uzupełnianie nazw dla Dockera
91 Group: Applications/Shells
93 Requires: bash-completion >= 2.0
94 Obsoletes: bash-completion-lxc-docker < 1.1.1
95 %if "%{_rpmversion}" >= "5"
99 %description -n bash-completion-%{name}
100 This package provides bash-completion for Docker.
102 %description -n bash-completion-%{name} -l pl.UTF-8
103 Pakiet ten dostarcza bashowe uzupełnianie nazw dla Dockera.
105 %package -n zsh-completion-%{name}
106 Summary: zsh completion for Docker
107 Summary(pl.UTF-8): Uzupełnianie parametrów w zsh dla poleceń Dockera
108 Group: Applications/Shells
110 %if "%{_rpmversion}" >= "5"
114 %description -n zsh-completion-%{name}
115 This package provides zsh completion for Docker.
117 %description -n zsh-completion-%{name} -l pl.UTF-8
118 Pakiet ten dostarcza uzupełnianie w zsh dla poleceń Dockera.
120 %package -n vim-syntax-%{name}
121 Summary: Vim syntax: Docker
122 Group: Applications/Editors/Vim
123 Requires: %{name} = %{version}-%{release}
124 Requires: vim-rt >= 4:7.2.170
125 Obsoletes: vim-syntax-lxc-docker < 1.1.1
126 %if "%{_rpmversion}" >= "5"
130 %description -n vim-syntax-%{name}
131 This plugin provides syntax highlighting in Dockerfile.
134 %setup -q %{?subver:-n %{name}-%{version}%{subver}} -a1 -a2
135 mv runc-%{runc_commit}* runc
136 mv containerd-%{containerd_commit}* containerd
139 install -d vendor/src/github.com/docker
140 ln -s $(pwd) vendor/src/github.com/docker/docker
141 ln -s $(pwd)/containerd containerd/vendor/src/github.com/docker/containerd
144 v=$(awk '/ENV RUNC_COMMIT/ {print $3}' Dockerfile)
145 echo "$v" | grep "^%{runc_commit}"
146 v=$(awk '/ENV CONTAINERD_COMMIT/ {print $3}' Dockerfile)
147 echo "$v" | grep "^%{containerd_commit}"
149 export GOPATH=$(pwd)/vendor:$(pwd)/containerd/vendor
150 export DOCKER_GITCOMMIT="pld/%{version}"
155 # build docker-containerd
156 %{__make} -C containerd
158 bash -x hack/make.sh dynbinary
164 rm -rf $RPM_BUILD_ROOT
165 install -d $RPM_BUILD_ROOT{%{_bindir},%{_sbindir},%{_mandir}/man1,/etc/{rc.d/init.d,sysconfig},%{systemdunitdir}} \
166 $RPM_BUILD_ROOT%{_libexecdir} \
167 $RPM_BUILD_ROOT/var/lib/docker/{containers,execdriver,graph,image,init,network,swarm,tmp,trust,vfs,volumes}
169 install -p bundles/%{version}%{?subver}/dynbinary-client/docker-%{version}%{?subver} $RPM_BUILD_ROOT%{_bindir}/docker
170 install -p bundles/%{version}%{?subver}/dynbinary-daemon/docker-proxy-%{version}%{?subver} $RPM_BUILD_ROOT%{_sbindir}/docker-proxy
171 install -p bundles/%{version}%{?subver}/dynbinary-daemon/dockerd-%{version}%{?subver} $RPM_BUILD_ROOT%{_sbindir}/dockerd
173 # install docker-runc
174 install -p runc/runc $RPM_BUILD_ROOT%{_sbindir}/docker-runc
176 # install docker-containerd
177 install -p containerd/bin/containerd $RPM_BUILD_ROOT%{_sbindir}/docker-containerd
178 install -p containerd/bin/containerd-shim $RPM_BUILD_ROOT%{_sbindir}/docker-containerd-shim
179 install -p containerd/bin/ctr $RPM_BUILD_ROOT%{_sbindir}/docker-containerd-ctr
181 cp -p contrib/init/systemd/docker.service $RPM_BUILD_ROOT%{systemdunitdir}
182 cp -p contrib/init/systemd/docker.socket $RPM_BUILD_ROOT%{systemdunitdir}
183 install -p %{SOURCE7} $RPM_BUILD_ROOT/etc/rc.d/init.d/docker
184 install -p %{SOURCE4} $RPM_BUILD_ROOT%{_libexecdir}/docker
185 cp -p %{SOURCE8} $RPM_BUILD_ROOT/etc/sysconfig/docker
188 install -d $RPM_BUILD_ROOT/lib/udev/rules.d
189 cp -p contrib/udev/80-docker.rules $RPM_BUILD_ROOT/lib/udev/rules.d
191 # bash and zsh completion
192 install -d $RPM_BUILD_ROOT%{bash_compdir}
193 cp -p contrib/completion/bash/docker $RPM_BUILD_ROOT%{bash_compdir}/docker
194 install -d $RPM_BUILD_ROOT%{zsh_compdir}
195 cp -p contrib/completion/zsh/_docker $RPM_BUILD_ROOT%{zsh_compdir}
199 install -d $RPM_BUILD_ROOT%{_vimdatadir}
200 cp -a contrib/syntax/vim/* $RPM_BUILD_ROOT%{_vimdatadir}
201 %{__rm} $RPM_BUILD_ROOT%{_vimdatadir}/{LICENSE,README.md}
205 %groupadd -g 296 docker
208 /sbin/chkconfig --add %{name}
209 %service -n %{name} restart
210 %systemd_post %{name}.service
213 if [ "$1" = "0" ]; then
214 %service -q %{name} stop
215 /sbin/chkconfig --del %{name}
217 %systemd_preun %{name}.service
220 if [ "$1" = "0" ]; then
226 rm -rf $RPM_BUILD_ROOT
229 %defattr(644,root,root,755)
230 %doc README.md CHANGELOG.md CONTRIBUTING.md LICENSE AUTHORS NOTICE MAINTAINERS
231 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/docker
232 %attr(754,root,root) /etc/rc.d/init.d/docker
233 %attr(755,root,root) %{_bindir}/docker
234 %attr(755,root,root) %{_sbindir}/docker-containerd
235 %attr(755,root,root) %{_sbindir}/docker-containerd-ctr
236 %attr(755,root,root) %{_sbindir}/docker-containerd-shim
237 %attr(755,root,root) %{_sbindir}/docker-proxy
238 %attr(755,root,root) %{_sbindir}/docker-runc
239 %attr(755,root,root) %{_sbindir}/dockerd
240 %attr(755,root,root) %{_libexecdir}/docker
241 %{systemdunitdir}/docker.service
242 %{systemdunitdir}/docker.socket
243 /lib/udev/rules.d/80-docker.rules
245 %dir %attr(700,root,root) /var/lib/docker
246 %dir %attr(700,root,root) /var/lib/docker/containers
247 %dir %attr(700,root,root) /var/lib/docker/execdriver
248 %dir %attr(700,root,root) /var/lib/docker/graph
249 %dir %attr(700,root,root) /var/lib/docker/image
250 %dir %attr(700,root,root) /var/lib/docker/init
251 %dir %attr(700,root,root) /var/lib/docker/network
252 %dir %attr(700,root,root) /var/lib/docker/swarm
253 %dir %attr(700,root,root) /var/lib/docker/tmp
254 %dir %attr(700,root,root) /var/lib/docker/trust
255 %dir %attr(700,root,root) /var/lib/docker/vfs
256 %dir %attr(700,root,root) /var/lib/docker/volumes
258 %files -n bash-completion-%{name}
259 %defattr(644,root,root,755)
260 %{bash_compdir}/docker
262 %files -n zsh-completion-%{name}
263 %defattr(644,root,root,755)
264 %{zsh_compdir}/_docker
267 %files -n vim-syntax-%{name}
268 %defattr(644,root,root,755)
269 %doc contrib/syntax/vim/{README.md,LICENSE}
270 %{_vimdatadir}/doc/dockerfile.txt
271 %{_vimdatadir}/ftdetect/dockerfile.vim
272 %{_vimdatadir}/syntax/dockerfile.vim