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.228
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: tar >= 1:1.26
47 Requires: uname(release) >= 3.8
49 Suggests: git-core >= 1.7
52 Provides: group(docker)
53 Obsoletes: lxc-docker < 1.1.1
54 # only runs on x64 hosts for now:
55 # https://github.com/docker/docker/issues/136
56 # https://github.com/docker/docker/issues/611
57 ExclusiveArch: %{x8664}
58 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
60 %define bash_compdir %{_datadir}/bash-completion/completions
61 %define zsh_compdir %{_datadir}/zsh/site-functions
62 %define _vimdatadir %{_datadir}/vim
63 %define _libexecdir %{_prefix}/lib
65 # binary stripped or something
66 %define _enable_debug_packages 0
69 Docker is an open source project to pack, ship and run any application
70 as a lightweight container
72 Docker containers are both hardware-agnostic and platform-agnostic.
73 This means that they can run anywhere, from your laptop to the largest
74 EC2 compute instance and everything in between - and they don't
75 require that you use a particular language, framework or packaging
76 system. That makes them great building blocks for deploying and
77 scaling web apps, databases and backend services without depending on
78 a particular stack or provider.
80 Docker is an open-source implementation of the deployment engine which
81 powers dotCloud, a popular Platform-as-a-Service. It benefits directly
82 from the experience accumulated over several years of large-scale
83 operation and support of hundreds of thousands of applications and
86 %package -n bash-completion-%{name}
87 Summary: bash-completion for Docker
88 Summary(pl.UTF-8): bashowe uzupełnianie nazw dla Dockera
89 Group: Applications/Shells
91 Requires: bash-completion >= 2.0
92 Obsoletes: bash-completion-lxc-docker < 1.1.1
93 %if "%{_rpmversion}" >= "5"
97 %description -n bash-completion-%{name}
98 This package provides bash-completion for Docker.
100 %description -n bash-completion-%{name} -l pl.UTF-8
101 Pakiet ten dostarcza bashowe uzupełnianie nazw dla Dockera.
103 %package -n zsh-completion-%{name}
104 Summary: zsh completion for Docker
105 Summary(pl.UTF-8): Uzupełnianie parametrów w zsh dla poleceń Dockera
106 Group: Applications/Shells
108 %if "%{_rpmversion}" >= "5"
112 %description -n zsh-completion-%{name}
113 This package provides zsh completion for Docker.
115 %description -n zsh-completion-%{name} -l pl.UTF-8
116 Pakiet ten dostarcza uzupełnianie w zsh dla poleceń Dockera.
118 %package -n vim-syntax-%{name}
119 Summary: Vim syntax: Docker
120 Group: Applications/Editors/Vim
121 Requires: %{name} = %{version}-%{release}
122 Requires: vim-rt >= 4:7.2.170
123 Obsoletes: vim-syntax-lxc-docker < 1.1.1
124 %if "%{_rpmversion}" >= "5"
128 %description -n vim-syntax-%{name}
129 This plugin provides syntax highlighting in Dockerfile.
132 %setup -q %{?subver:-n %{name}-%{version}%{subver}} -a1 -a2
133 mv runc-%{runc_commit}* runc
134 mv containerd-%{containerd_commit}* containerd
137 install -d vendor/src/github.com/docker
138 ln -s $(pwd) vendor/src/github.com/docker/docker
139 ln -s $(pwd)/containerd containerd/vendor/src/github.com/docker/containerd
142 v=$(awk '/ENV RUNC_COMMIT/ {print $3}' Dockerfile)
143 echo "$v" | grep "^%{runc_commit}"
144 v=$(awk '/ENV CONTAINERD_COMMIT/ {print $3}' Dockerfile)
145 echo "$v" | grep "^%{containerd_commit}"
147 export GOPATH=$(pwd)/vendor:$(pwd)/containerd/vendor
148 export DOCKER_GITCOMMIT="pld/%{version}"
153 # build docker-containerd
154 %{__make} -C containerd
156 bash -x hack/make.sh dynbinary
162 rm -rf $RPM_BUILD_ROOT
163 install -d $RPM_BUILD_ROOT{%{_bindir},%{_sbindir},%{_mandir}/man1,/etc/{rc.d/init.d,sysconfig},%{systemdunitdir}} \
164 $RPM_BUILD_ROOT%{_libexecdir} \
165 $RPM_BUILD_ROOT/var/lib/docker/{containers,execdriver,graph,image,init,network,swarm,tmp,trust,vfs,volumes}
167 install -p bundles/%{version}%{?subver}/dynbinary-client/docker-%{version}%{?subver} $RPM_BUILD_ROOT%{_bindir}/docker
168 install -p bundles/%{version}%{?subver}/dynbinary-daemon/docker-proxy-%{version}%{?subver} $RPM_BUILD_ROOT%{_sbindir}/docker-proxy
169 install -p bundles/%{version}%{?subver}/dynbinary-daemon/dockerd-%{version}%{?subver} $RPM_BUILD_ROOT%{_sbindir}/dockerd
171 # install docker-runc
172 install -p runc/runc $RPM_BUILD_ROOT%{_sbindir}/docker-runc
174 # install docker-containerd
175 install -p containerd/bin/containerd $RPM_BUILD_ROOT%{_sbindir}/docker-containerd
176 install -p containerd/bin/containerd-shim $RPM_BUILD_ROOT%{_sbindir}/docker-containerd-shim
177 install -p containerd/bin/ctr $RPM_BUILD_ROOT%{_sbindir}/docker-containerd-ctr
179 cp -p contrib/init/systemd/docker.service $RPM_BUILD_ROOT%{systemdunitdir}
180 cp -p contrib/init/systemd/docker.socket $RPM_BUILD_ROOT%{systemdunitdir}
181 install -p %{SOURCE7} $RPM_BUILD_ROOT/etc/rc.d/init.d/docker
182 install -p %{SOURCE4} $RPM_BUILD_ROOT%{_libexecdir}/docker
183 cp -p %{SOURCE8} $RPM_BUILD_ROOT/etc/sysconfig/docker
186 install -d $RPM_BUILD_ROOT/lib/udev/rules.d
187 cp -p contrib/udev/80-docker.rules $RPM_BUILD_ROOT/lib/udev/rules.d
189 # bash and zsh completion
190 install -d $RPM_BUILD_ROOT%{bash_compdir}
191 cp -p contrib/completion/bash/docker $RPM_BUILD_ROOT%{bash_compdir}/docker
192 install -d $RPM_BUILD_ROOT%{zsh_compdir}
193 cp -p contrib/completion/zsh/_docker $RPM_BUILD_ROOT%{zsh_compdir}
197 install -d $RPM_BUILD_ROOT%{_vimdatadir}
198 cp -a contrib/syntax/vim/* $RPM_BUILD_ROOT%{_vimdatadir}
199 %{__rm} $RPM_BUILD_ROOT%{_vimdatadir}/{LICENSE,README.md}
203 %groupadd -g 296 docker
206 /sbin/chkconfig --add %{name}
207 %service -n %{name} restart
208 %systemd_post %{name}.service
211 if [ "$1" = "0" ]; then
212 %service -q %{name} stop
213 /sbin/chkconfig --del %{name}
215 %systemd_preun %{name}.service
218 if [ "$1" = "0" ]; then
224 rm -rf $RPM_BUILD_ROOT
227 %defattr(644,root,root,755)
228 %doc README.md CHANGELOG.md CONTRIBUTING.md LICENSE AUTHORS NOTICE MAINTAINERS
229 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/docker
230 %attr(754,root,root) /etc/rc.d/init.d/docker
231 %attr(755,root,root) %{_bindir}/docker
232 %attr(755,root,root) %{_sbindir}/docker-containerd
233 %attr(755,root,root) %{_sbindir}/docker-containerd-ctr
234 %attr(755,root,root) %{_sbindir}/docker-containerd-shim
235 %attr(755,root,root) %{_sbindir}/docker-proxy
236 %attr(755,root,root) %{_sbindir}/docker-runc
237 %attr(755,root,root) %{_sbindir}/dockerd
238 %attr(755,root,root) %{_libexecdir}/docker
239 %{systemdunitdir}/docker.service
240 %{systemdunitdir}/docker.socket
241 /lib/udev/rules.d/80-docker.rules
243 %dir %attr(700,root,root) /var/lib/docker
244 %dir %attr(700,root,root) /var/lib/docker/containers
245 %dir %attr(700,root,root) /var/lib/docker/execdriver
246 %dir %attr(700,root,root) /var/lib/docker/graph
247 %dir %attr(700,root,root) /var/lib/docker/image
248 %dir %attr(700,root,root) /var/lib/docker/init
249 %dir %attr(700,root,root) /var/lib/docker/network
250 %dir %attr(700,root,root) /var/lib/docker/swarm
251 %dir %attr(700,root,root) /var/lib/docker/tmp
252 %dir %attr(700,root,root) /var/lib/docker/trust
253 %dir %attr(700,root,root) /var/lib/docker/vfs
254 %dir %attr(700,root,root) /var/lib/docker/volumes
256 %files -n bash-completion-%{name}
257 %defattr(644,root,root,755)
258 %{bash_compdir}/docker
260 %files -n zsh-completion-%{name}
261 %defattr(644,root,root,755)
262 %{zsh_compdir}/_docker
265 %files -n vim-syntax-%{name}
266 %defattr(644,root,root,755)
267 %doc contrib/syntax/vim/{README.md,LICENSE}
268 %{_vimdatadir}/doc/dockerfile.txt
269 %{_vimdatadir}/ftdetect/dockerfile.vim
270 %{_vimdatadir}/syntax/dockerfile.vim