%global __requires_exclude '.*/bin/make' # modifying the dockerinit binary breaks the SHA1 sum check by docker %global __os_install_post %{_usrlibrpm}/brp-compress %define debug_package %{nil} %global commit 89658bed64c2a8fe05a978e5b87dbec409d57a0f %global shortcommit %(c=%{commit}; echo ${c:0:7}) %define tini_ver 0.19.0 Summary: Automates deployment of containerized applications Name: docker Version: 19.03.13 Release: 1 License: ASL 2.0 Group: System/Kernel and hardware Url: http://www.docker.com # only x86_64 for now: https://github.com/docker/docker/issues/136 #ExclusiveArch: x86_64 Source0: https://github.com/docker/docker-ce/archive/v%{version}.tar.gz?/%{name}-ce-%{version}.tar.gz Source1: %{name}.service Source2: %{name}.sysconfig Source3: %{name}-storage.sysconfig Source6: %{name}-network.sysconfig Source7: %{name}.socket Source8: %{name}-network-cleanup.sh Source9: overlay.conf Source10: https://github.com/docker/libnetwork/archive/master.zip?/libnetwork-master.zip Source11: https://github.com/krallin/tini/archive/v%{tini_ver}.tar.gz?/tini-%{tini_ver}.tar.gz Source100: %{name}.rpmlintrc BuildRequires: cmake BuildRequires: go-md2man BuildRequires: golang BuildRequires: systemd BuildRequires: btrfs-devel BuildRequires: glibc-devel BuildRequires: glibc-static-devel BuildRequires: libtool-devel BuildRequires: pkgconfig(devmapper) BuildRequires: pkgconfig(libseccomp) BuildRequires: pkgconfig(sqlite3) BuildRequires: pkgconfig(systemd) Requires: bridge-utils Requires: %{name}-containerd Requires: runc # need xz to work with ubuntu images # https://bugzilla.redhat.com/show_bug.cgi?id=1045220 Requires: xz Requires(pre): rpm-helper Requires(post,preun,postun): systemd # https://bugzilla.redhat.com/show_bug.cgi?id=1034919 # No longer needed in Fedora because of libcontainer Provides: lxc-%{name} = %{EVRD} Provides: %{name}-swarm = %{EVRD} %description Docker is an open-source engine that automates the deployment of any application as a lightweight, portable, self-sufficient container that will run virtually anywhere. Docker containers can encapsulate any payload, and will run consistently on and between virtually any server. The same container that a developer builds and tests on a laptop will run at scale, in production*, on VMs, bare-metal servers, OpenStack clusters, public instances, or combinations of the above. %files %doc CHANGELOG.md CONTRIBUTING.md README.md %config(noreplace) %{_sysconfdir}/sysconfig/%{name} %config(noreplace) %{_sysconfdir}/sysconfig/%{name}-network %config(noreplace) %{_sysconfdir}/sysconfig/%{name}-storage %{_bindir}/%{name} %{_bindir}/%{name}-proxy %{_bindir}/%{name}-init %{_sbindir}/%{name}-network-cleanup %{_sbindir}/%{name}d %{_presetdir}/86-%{name}.preset %{_unitdir}/%{name}.service %{_unitdir}/%{name}.socket %{_sysconfdir}/bash_completion.d/%{name}.bash %dir %{_localstatedir}/lib/%{name} %{_udevrulesdir}/80-%{name}.rules %{_sysconfdir}/modules-load.d/overlay.conf %pre getent group %{name} > /dev/null || %{_sbindir}/groupadd -r %{name} exit 0 %post %systemd_post %{name} %preun %systemd_preun %{name} %postun %systemd_postun_with_restart %{name} #------------------------------------------------------------------ %package fish-completion Summary: Fish completion files for Docker Group: System/Kernel and hardware Requires: %{name} = %{EVRD} Recommends: fish Provides: %{name}-io-fish-completion = %{EVRD} %description fish-completion This package installs %{summary}. %files fish-completion %doc README.md %{_datadir}/fish/vendor_completions.d/%{name}.fish #------------------------------------------------------------------ %package vim Summary: Vim syntax highlighting files for Docker Group: System/Kernel and hardware Requires: %{name} = %{EVRD} Requires: vim Provides: %{name}-io-vim = %{EVRD} %description vim This package installs %{summary}. %files vim %doc README.md %{_datadir}/vim/vimfiles/ftdetect/%{name}file.vim %{_datadir}/vim/vimfiles/syntax/%{name}file.vim #------------------------------------------------------------------ %package zsh-completion Summary: Zsh completion files for Docker Group: System/Kernel and hardware Requires: %{name} = %{EVRD} Requires: zsh Provides: %{name}-io-zsh-completion = %{EVRD} %description zsh-completion This package installs %{summary}. %files zsh-completion %doc README.md %{_datadir}/zsh/site-functions/_%{name} #------------------------------------------------------------------ %prep %setup -q -n %{name}-ce-%{version} -a10 -a11 mv libnetwork-master libnetwork mv tini-* tini %build # magic again fake_gopath_pushd() { mkdir -p "$(pwd)/src/${2%/*}" rm -f "$(pwd)/src/$2" ln -rsT "$1" "$(pwd)/src/$2" pushd "$(pwd)/src/$2" >/dev/null } fake_gopath_popd() { popd >/dev/null } export DOCKER_GITCOMMIT="%{shortcommit}" mkdir -p src/github.com/%{name} export GOPATH=%{_libdir}/golang:$(pwd) # MAGIC HERE ln -s ../../../components/cli src/github.com/%{name} ln -s ../../../components/engine src/github.com/%{name}/%{name} # dockerd pushd components/engine DOCKER_BUILDTAGS='seccomp journald' VERSION=%{version} hack/make.sh dynbinary popd # docker cli pushd components/cli DISABLE_WARN_OUTSIDE_CONTAINER=1 make VERSION=%{version} dynbinary popd ### docker proxy fake_gopath_pushd libnetwork github.com/%{name}/libnetwork go build -ldflags='-linkmode=external' github.com/%{name}/libnetwork/cmd/proxy fake_gopath_popd ### docker-init fake_gopath_pushd tini github.com/krallin/tini %cmake %make tini-static fake_gopath_popd %install # install binaries install -d %{buildroot}%{_bindir} install -p -m 755 components/cli/build/%{name}-linux-* %{buildroot}%{_bindir}/%{name} install -d %{buildroot}%{_sbindir} install -p -m 755 components/engine/bundles/dynbinary-daemon/%{name}d-%{version} %{buildroot}%{_sbindir}/%{name}d install -p -m 755 libnetwork/proxy %{buildroot}%{_bindir}/%{name}-proxy install -p -m 755 tini/build/tini-static %{buildroot}%{_bindir}/%{name}-init # Place to store images install -d %{buildroot}%{_localstatedir}/lib/%{name} # install bash completion install -d %{buildroot}%{_sysconfdir}/bash_completion.d install -p -m 644 components/cli/contrib/completion/bash/%{name} %{buildroot}%{_sysconfdir}/bash_completion.d/%{name}.bash # install fish completion # create, install and own /usr/share/fish/vendor_completions.d until # upstream fish provides it install -dp %{buildroot}%{_datadir}/fish/vendor_completions.d install -p -m 644 components/cli/contrib/completion/fish/%{name}.fish %{buildroot}%{_datadir}/fish/vendor_completions.d # install vim syntax highlighting install -d %{buildroot}%{_datadir}/vim/vimfiles/{doc,ftdetect,syntax} install -p -m 644 components/engine/contrib/syntax/vim/ftdetect/%{name}file.vim %{buildroot}%{_datadir}/vim/vimfiles/ftdetect install -p -m 644 components/engine/contrib/syntax/vim/syntax/%{name}file.vim %{buildroot}%{_datadir}/vim/vimfiles/syntax # install zsh completion install -d %{buildroot}%{_datadir}/zsh/site-functions install -p -m 644 components/cli/contrib/completion/zsh/_%{name} %{buildroot}%{_datadir}/zsh/site-functions # install udev rules install -d %{buildroot}%{_udevrulesdir} install -p -m 644 components/engine/contrib/udev/80-%{name}.rules %{buildroot}%{_udevrulesdir} # install storage dir install -d -m 700 %{buildroot}%{_localstatedir}/lib/%{name} # install systemd/init scripts install -d %{buildroot}%{_unitdir} install -p -m 644 %{SOURCE1} %{SOURCE7} %{buildroot}%{_unitdir} # for additional args install -d %{buildroot}%{_sysconfdir}/sysconfig/ install -p -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{name} install -p -m 644 %{SOURCE6} %{buildroot}%{_sysconfdir}/sysconfig/%{name}-network install -p -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/%{name}-storage #network cleanup install -d %{buildroot}%{_sbindir} install -p -m 755 %{SOURCE8} %{buildroot}%{_sbindir}/%{name}-network-cleanup install -d %{buildroot}%{_presetdir} cat > %{buildroot}%{_presetdir}/86-%{name}.preset << EOF enable %{name}.socket EOF install -d %{buildroot}%{_sysconfdir}/modules-load.d/ install -p -m 644 %{SOURCE9} %{buildroot}%{_sysconfdir}/modules-load.d/overlay.conf