provide docker(engine) for docker-compose
[packages/docker.git] / docker.spec
1 #
2 # Conditional build:
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
6
7 # NOTES
8 # https://github.com/docker/docker/blob/master/project/PACKAGERS.md#build-dependencies
9
10 # v1.0.0-rc2-133-g9df8b30
11 %define runc_commit 9df8b30
12 # v0.2.3-85-gaa8187d
13 %define containerd_commit aa8187d
14 # v0.8.0-dev.2-464-g0f53435
15 %define libnetwork_commit 0f53435
16 #define subver -rc7
17 Summary:        Docker: the open-source application container engine
18 Name:           docker
19 Version:        1.13.1
20 Release:        2
21 License:        Apache v2.0
22 Group:          Applications/System
23 # https://github.com/docker/docker/releases
24 Source0:        https://github.com/docker/docker/archive/v%{version}/%{name}-%{version}.tar.gz
25 # Source0-md5:  032c39b2390a0f387cdb49bab8c4c712
26 Source1:        https://github.com/docker/runc/archive/%{runc_commit}/runc-%{runc_commit}.tar.gz
27 # Source1-md5:  43ee79eaf575db8a212058c30997e45d
28 Source2:        https://github.com/docker/containerd/archive/%{containerd_commit}/containerd-%{containerd_commit}.tar.gz
29 # Source2-md5:  01c58df940b94910996ecb8096fd8b71
30 Source3:        https://github.com/docker/libnetwork/archive/%{libnetwork_commit}/libnetwork-%{libnetwork_commit}.tar.gz
31 # Source3-md5:  7cfbfe76355aae3577c77a6a4b2c92db
32 Source4:        https://github.com/krallin/tini/archive/v0.13.0/tini-0.13.0.tar.gz
33 # Source4-md5:  c29541112a242c53c82bb6b1213f288f
34 Source5:        %{name}d.sh
35 Source7:        %{name}.init
36 Source8:        %{name}.sysconfig
37 Patch0:         systemd.patch
38 URL:            http://www.docker.com/
39 BuildRequires:  btrfs-progs-devel >= 3.16.1
40 BuildRequires:  cmake
41 BuildRequires:  device-mapper-devel >= 2.02.89
42 BuildRequires:  golang >= 1.6
43 BuildRequires:  libseccomp-devel >= 2.2.1
44 BuildRequires:  rpmbuild(macros) >= 1.644
45 BuildRequires:  sqlite3-devel >= 3.7.9
46 Requires(post,preun):   /sbin/chkconfig
47 Requires(postun):       /usr/sbin/groupdel
48 Requires(pre):  /usr/bin/getgid
49 Requires(pre):  /usr/sbin/groupadd
50 Requires:       ca-certificates
51 Requires:       iproute2 >= 3.5
52 Requires:       iptables
53 Requires:       rc-scripts >= 0.4.0.10
54 Requires:       systemd-units >= 38
55 Requires:       tar >= 1:1.26
56 Requires:       uname(release) >= 3.8
57 Requires:       xz
58 Suggests:       docker-credential-helpers
59 Suggests:       git-core >= 1.7
60 Suggests:       libcgroup
61 Suggests:       xz >= 1:4.9
62 Provides:       docker(engine) = %{version}
63 Provides:       group(docker)
64 Obsoletes:      lxc-docker < 1.1.1
65 # only runs on x64 hosts for now:
66 # https://github.com/docker/docker/issues/136
67 # https://github.com/docker/docker/issues/611
68 ExclusiveArch:  %{x8664}
69 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
70
71 %define         bash_compdir    %{_datadir}/bash-completion/completions
72 %define         zsh_compdir     %{_datadir}/zsh/site-functions
73 %define         _vimdatadir             %{_datadir}/vim
74 %define         _libexecdir             %{_prefix}/lib
75
76 # binary stripped or something
77 %define         _enable_debug_packages 0
78
79 %description
80 Docker is an open source project to pack, ship and run any application
81 as a lightweight container
82
83 Docker containers are both hardware-agnostic and platform-agnostic.
84 This means that they can run anywhere, from your laptop to the largest
85 EC2 compute instance and everything in between - and they don't
86 require that you use a particular language, framework or packaging
87 system. That makes them great building blocks for deploying and
88 scaling web apps, databases and backend services without depending on
89 a particular stack or provider.
90
91 Docker is an open-source implementation of the deployment engine which
92 powers dotCloud, a popular Platform-as-a-Service. It benefits directly
93 from the experience accumulated over several years of large-scale
94 operation and support of hundreds of thousands of applications and
95 databases.
96
97 %package -n bash-completion-%{name}
98 Summary:        bash-completion for Docker
99 Summary(pl.UTF-8):      bashowe uzupełnianie nazw dla Dockera
100 Group:          Applications/Shells
101 Requires:       %{name}
102 Requires:       bash-completion >= 2.0
103 Obsoletes:      bash-completion-lxc-docker < 1.1.1
104 %if "%{_rpmversion}" >= "5"
105 BuildArch:      noarch
106 %endif
107
108 %description -n bash-completion-%{name}
109 This package provides bash-completion for Docker.
110
111 %description -n bash-completion-%{name} -l pl.UTF-8
112 Pakiet ten dostarcza bashowe uzupełnianie nazw dla Dockera.
113
114 %package -n zsh-completion-%{name}
115 Summary:        zsh completion for Docker
116 Summary(pl.UTF-8):      Uzupełnianie parametrów w zsh dla poleceń Dockera
117 Group:          Applications/Shells
118 Requires:       %{name}
119 %if "%{_rpmversion}" >= "5"
120 BuildArch:      noarch
121 %endif
122
123 %description -n zsh-completion-%{name}
124 This package provides zsh completion for Docker.
125
126 %description -n zsh-completion-%{name} -l pl.UTF-8
127 Pakiet ten dostarcza uzupełnianie w zsh dla poleceń Dockera.
128
129 %package -n vim-syntax-%{name}
130 Summary:        Vim syntax: Docker
131 Group:          Applications/Editors/Vim
132 Requires:       %{name} = %{version}-%{release}
133 Requires:       vim-rt >= 4:7.2.170
134 Obsoletes:      vim-syntax-lxc-docker < 1.1.1
135 %if "%{_rpmversion}" >= "5"
136 BuildArch:      noarch
137 %endif
138
139 %description -n vim-syntax-%{name}
140 This plugin provides syntax highlighting in Dockerfile.
141
142 %prep
143 %setup -q %{?subver:-n %{name}-%{version}%{subver}} -a1 -a2 -a3 -a4
144 mv runc-%{runc_commit}* runc
145 mv containerd-%{containerd_commit}* containerd
146 mv libnetwork-%{libnetwork_commit}* libnetwork
147 mv tini-* tini
148 %patch0 -p1
149
150 install -d vendor/src/github.com/docker
151 ln -s $(pwd) vendor/src/github.com/docker/docker
152 ln -s $(pwd)/containerd containerd/vendor/src/github.com/docker/containerd
153 ln -s $(pwd)/libnetwork vendor/src/github.com/docker/libnetwork
154
155 %build
156 v=$(awk -F= '/^RUNC_COMMIT/ {print $2}' hack/dockerfile/binaries-commits)
157 echo "$v" | grep "^%{runc_commit}"
158 v=$(awk -F= '/^CONTAINERD_COMMIT/ {print $2}' hack/dockerfile/binaries-commits)
159 echo "$v" | grep "^%{containerd_commit}"
160 v=$(awk -F= '/^LIBNETWORK_COMMIT/ {print $2}' hack/dockerfile/binaries-commits)
161 echo "$v" | grep "^%{libnetwork_commit}"
162
163 export GOPATH=$(pwd)/vendor:$(pwd)/containerd/vendor
164 export DOCKER_GITCOMMIT="pld/%{version}"
165 # build docker-runc
166 %{__make} -C runc
167
168 # build docker-containerd
169 %{__make} -C containerd
170
171 # build docker-proxy
172 go build -ldflags="-linkmode=external" \
173         -o docker-proxy \
174         github.com/docker/libnetwork/cmd/proxy
175
176 # build docker-init
177 cd tini
178 cmake .
179 %{__make}
180 cd ..
181
182 bash -x hack/make.sh dynbinary
183 %if %{with doc}
184 man/md2man-all.sh
185 %endif
186
187 %install
188 rm -rf $RPM_BUILD_ROOT
189 install -d $RPM_BUILD_ROOT{%{_bindir},%{_sbindir},%{_mandir}/man1,/etc/{rc.d/init.d,sysconfig},%{systemdunitdir}} \
190         $RPM_BUILD_ROOT%{_libexecdir} \
191         $RPM_BUILD_ROOT/var/lib/docker/{containers,execdriver,graph,image,init,network,swarm,tmp,trust,vfs,volumes}
192
193 install -p bundles/%{version}%{?subver}/dynbinary-client/docker-%{version}%{?subver} $RPM_BUILD_ROOT%{_bindir}/docker
194 install -p bundles/%{version}%{?subver}/dynbinary-daemon/dockerd-%{version}%{?subver} $RPM_BUILD_ROOT%{_sbindir}/dockerd
195
196 # install docker-runc
197 install -p runc/runc $RPM_BUILD_ROOT%{_sbindir}/docker-runc
198
199 # install docker-containerd
200 install -p containerd/bin/containerd $RPM_BUILD_ROOT%{_sbindir}/docker-containerd
201 install -p containerd/bin/containerd-shim $RPM_BUILD_ROOT%{_sbindir}/docker-containerd-shim
202 install -p containerd/bin/ctr $RPM_BUILD_ROOT%{_sbindir}/docker-containerd-ctr
203
204 # install docker-proxy
205 install -p docker-proxy $RPM_BUILD_ROOT%{_sbindir}/docker-proxy
206
207 # install docker-init
208 install -p tini/tini $RPM_BUILD_ROOT%{_sbindir}/docker-init
209
210 cp -p contrib/init/systemd/docker.service $RPM_BUILD_ROOT%{systemdunitdir}
211 cp -p contrib/init/systemd/docker.socket $RPM_BUILD_ROOT%{systemdunitdir}
212 install -p %{SOURCE7} $RPM_BUILD_ROOT/etc/rc.d/init.d/docker
213 install -p %{SOURCE5} $RPM_BUILD_ROOT%{_libexecdir}/dockerd
214 cp -p %{SOURCE8} $RPM_BUILD_ROOT/etc/sysconfig/docker
215
216 # install udev rules
217 install -d $RPM_BUILD_ROOT/lib/udev/rules.d
218 cp -p contrib/udev/80-docker.rules $RPM_BUILD_ROOT/lib/udev/rules.d
219
220 # bash and zsh completion
221 install -d $RPM_BUILD_ROOT%{bash_compdir}
222 cp -p contrib/completion/bash/docker $RPM_BUILD_ROOT%{bash_compdir}/docker
223 install -d $RPM_BUILD_ROOT%{zsh_compdir}
224 cp -p contrib/completion/zsh/_docker $RPM_BUILD_ROOT%{zsh_compdir}
225
226 # vim syntax
227 %if %{with vim}
228 install -d $RPM_BUILD_ROOT%{_vimdatadir}
229 cp -a contrib/syntax/vim/* $RPM_BUILD_ROOT%{_vimdatadir}
230 %{__rm} $RPM_BUILD_ROOT%{_vimdatadir}/{LICENSE,README.md}
231 %endif
232
233 %pre
234 %groupadd -g 296 docker
235
236 %post
237 /sbin/chkconfig --add %{name}
238 %service -n %{name} restart
239 %systemd_post %{name}.service
240
241 %preun
242 if [ "$1" = "0" ]; then
243         %service -q %{name} stop
244         /sbin/chkconfig --del %{name}
245 fi
246 %systemd_preun %{name}.service
247
248 %postun
249 if [ "$1" = "0" ]; then
250         %groupremove docker
251 fi
252 %systemd_reload
253
254 %clean
255 rm -rf $RPM_BUILD_ROOT
256
257 %files
258 %defattr(644,root,root,755)
259 %doc README.md CHANGELOG.md CONTRIBUTING.md LICENSE AUTHORS NOTICE MAINTAINERS
260 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/docker
261 %attr(754,root,root) /etc/rc.d/init.d/docker
262 %attr(755,root,root) %{_bindir}/docker
263 %attr(755,root,root) %{_sbindir}/docker-containerd
264 %attr(755,root,root) %{_sbindir}/docker-containerd-ctr
265 %attr(755,root,root) %{_sbindir}/docker-containerd-shim
266 %attr(755,root,root) %{_sbindir}/docker-init
267 %attr(755,root,root) %{_sbindir}/docker-proxy
268 %attr(755,root,root) %{_sbindir}/docker-runc
269 %attr(755,root,root) %{_sbindir}/dockerd
270 %attr(755,root,root) %{_libexecdir}/dockerd
271 %{systemdunitdir}/docker.service
272 %{systemdunitdir}/docker.socket
273 /lib/udev/rules.d/80-docker.rules
274
275 %dir %attr(700,root,root) /var/lib/docker
276 %dir %attr(700,root,root) /var/lib/docker/containers
277 %dir %attr(700,root,root) /var/lib/docker/execdriver
278 %dir %attr(700,root,root) /var/lib/docker/graph
279 %dir %attr(700,root,root) /var/lib/docker/image
280 %dir %attr(700,root,root) /var/lib/docker/init
281 %dir %attr(700,root,root) /var/lib/docker/network
282 %dir %attr(700,root,root) /var/lib/docker/swarm
283 %dir %attr(700,root,root) /var/lib/docker/tmp
284 %dir %attr(700,root,root) /var/lib/docker/trust
285 %dir %attr(700,root,root) /var/lib/docker/vfs
286 %dir %attr(700,root,root) /var/lib/docker/volumes
287
288 %files -n bash-completion-%{name}
289 %defattr(644,root,root,755)
290 %{bash_compdir}/docker
291
292 %files -n zsh-completion-%{name}
293 %defattr(644,root,root,755)
294 %{zsh_compdir}/_docker
295
296 %if %{with vim}
297 %files -n vim-syntax-%{name}
298 %defattr(644,root,root,755)
299 %doc contrib/syntax/vim/{README.md,LICENSE}
300 %{_vimdatadir}/doc/dockerfile.txt
301 %{_vimdatadir}/ftdetect/dockerfile.vim
302 %{_vimdatadir}/syntax/dockerfile.vim
303 %endif
This page took 0.145995 seconds and 3 git commands to generate.