docker/docker.spec

311 lines
9.7 KiB
RPMSpec
Raw Normal View History

2015-06-25 14:54:37 +03:00
# modifying the dockerinit binary breaks the SHA1 sum check by docker
2017-09-11 14:46:27 +03:00
2024-04-10 20:04:25 +00:00
%global tini_version 0.19.0
2024-05-17 21:33:26 +00:00
%global buildx_version 0.14.0
2015-06-25 14:54:37 +03:00
2024-04-10 20:04:25 +00:00
%global project docker
%global repo %{project}
%global import_path github.com/%{project}/%{repo}
2024-04-10 20:04:25 +00:00
#debuginfo not supported with Go
%global gopath %{_libdir}/golang
%define gosrc %{gopath}/src/pkg/%{import_path}
%global commit 659604f9ee60f147020bdd444b26e4b5c636dc28
%global shortcommit %(c=%{commit}; echo ${c:0:7})
2020-05-19 22:51:13 +03:00
2024-05-18 13:02:56 +00:00
%define _libexec /usr/libexec
%define _dockerpluginsdir %{_libexec}/docker/cli-plugins
2019-08-14 15:38:32 +03:00
Summary: Automates deployment of containerized applications
Name: docker
2024-05-17 21:33:26 +00:00
Version: 26.1.3
2024-04-10 20:04:25 +00:00
%global moby_version %{version}
2024-05-18 13:02:56 +00:00
Release: 2
2019-08-14 15:38:32 +03:00
License: ASL 2.0
2024-04-10 20:04:25 +00:00
Epoch: 1
Group: System/Configuration/Other
URL: https://www.docker.com
Source0: https://github.com/moby/moby/archive/v%{version}/moby-%{version}.tar.gz
Source1: %{repo}.service
Source2: %{repo}.sysconfig
Source3: %{repo}-storage.sysconfig
Source4: docker.sysusers
Source6: %{repo}-network.sysconfig
Source7: %{repo}.socket
Source8: %{repo}-network-cleanup.sh
2019-08-14 15:38:32 +03:00
Source9: overlay.conf
2024-04-10 20:04:25 +00:00
# docker-proxy
Source10: https://github.com/%{project}/libnetwork/archive/master/libnetwork-master.tar.gz
# tini
Source11: https://github.com/krallin/tini/archive/v%{tini_version}/tini-%{tini_version}.tar.gz
# cli
Source12: https://github.com/docker/cli/archive/v%{version}/cli-%{version}.tar.gz
# buildx
Source13: https://github.com/docker/buildx/archive/v%{buildx_version}/buildx-%{buildx_version}.tar.gz
# (tpg) taken from https://gist.github.com/goll/bdd6b43c2023f82d15729e9b0067de60
Source14: nftables-docker.nft
2024-04-10 22:04:45 +00:00
Source1000: %{name}.rpmlintrc
2024-04-10 20:04:25 +00:00
BuildRequires: gcc
2019-08-14 15:38:32 +03:00
BuildRequires: glibc-devel
BuildRequires: glibc-static-devel
2024-04-10 20:04:25 +00:00
BuildRequires: libltdl-devel
# ensure build uses golang 1.4 or above
BuildRequires: golang >= 1.7
2017-09-11 14:46:27 +03:00
BuildRequires: pkgconfig(sqlite3)
2024-04-10 20:04:25 +00:00
BuildRequires: go-md2man
BuildRequires: pkgconfig(devmapper)
BuildRequires: btrfs-devel
2019-08-14 15:38:32 +03:00
BuildRequires: pkgconfig(systemd)
2024-04-10 20:04:25 +00:00
BuildRequires: systemd
BuildRequires: libtool-devel
BuildRequires: pkgconfig(libseccomp)
BuildRequires: cmake
Requires(pre): systemd
%systemd_requires
# With docker >= 1.11 you now need containerd (and runC or crun as a dep)
2024-04-13 01:09:35 +03:00
Requires: containerd
2024-05-17 21:33:26 +00:00
Recommends: runc
Requires: crun
Requires: docker-compose
2024-05-18 13:02:56 +00:00
Recommends: docker-buildx
2015-06-25 14:54:37 +03:00
# need xz to work with ubuntu images
# https://bugzilla.redhat.com/show_bug.cgi?id=1045220
2019-08-14 15:38:32 +03:00
Requires: xz
2024-04-10 20:04:25 +00:00
Requires: bridge-utils
Requires(post): nftables
Requires(postun): sed
2015-06-25 14:54:37 +03:00
# https://bugzilla.redhat.com/show_bug.cgi?id=1034919
# No longer needed in Fedora because of libcontainer
2024-04-10 20:04:25 +00:00
Provides: lxc-docker = %{version}
Provides: docker-swarm = %{EVRD}
# compat with Docker repos for RH
Provides: docker-ce = %{EVRD}
#Recommends: (%{name}-fish-completion if fish)
#Recommends: (%{name}-zsh-completion if zsh)
#Recommends: (%{name}-vim if vim)
2015-06-25 14:54:37 +03:00
%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.
2016-06-17 18:03:06 +03:00
%package fish-completion
2024-04-10 20:04:25 +00:00
Summary: fish completion files for Docker
Requires: %{repo} = %{EVRD}
Provides: %{repo}-io-fish-completion = %{EVRD}
2016-06-17 18:03:06 +03:00
%description fish-completion
This package installs %{summary}.
2024-04-10 20:04:25 +00:00
%package unit-test
Summary: %{summary} - for running unit tests
2016-06-17 18:03:06 +03:00
2024-04-10 20:04:25 +00:00
%description unit-test
%{summary} - for running unit tests.
2016-06-17 18:03:06 +03:00
%package vim
2024-04-10 20:04:25 +00:00
Summary: vim syntax highlighting files for Docker
Requires: %{repo} = %{EVRD}
2019-08-14 15:38:32 +03:00
Requires: vim
2024-04-10 20:04:25 +00:00
Provides: %{repo}-io-vim = %{EVRD}
2016-06-17 18:03:06 +03:00
%description vim
This package installs %{summary}.
%package zsh-completion
2024-04-10 20:04:25 +00:00
Summary: zsh completion files for Docker
Requires: %{repo} = %{EVRD}
2019-08-14 15:38:32 +03:00
Requires: zsh
2024-04-10 20:04:25 +00:00
Provides: %{repo}-io-zsh-completion = %{EVRD}
2016-06-17 18:03:06 +03:00
%description zsh-completion
This package installs %{summary}.
2015-06-25 14:54:37 +03:00
%prep
2024-04-10 20:04:25 +00:00
%setup -qn moby-%{version}
tar xf %{SOURCE10}
tar xf %{SOURCE11}
mv tini-%{tini_version} tini
tar xf %{SOURCE12}
tar xf %{SOURCE13}
mv buildx-%{buildx_version} buildx
find . -name "*~" |xargs rm || :
# Needs to be done after unpacking extra bits, given we may want
# to patch tini -- so no %%autosetup
#autopatch -p1
%apply_patches
2015-06-25 14:54:37 +03:00
%build
2024-04-10 20:04:25 +00:00
mkdir -p GO/src/github.com/{docker,krallin}
ln -s $(pwd)/cli-%{version} GO/src/github.com/docker/cli
ln -s $(pwd)/libnetwork-master GO/src/github.com/docker/libnetwork
ln -s $(pwd)/tini GO/src/github.com/krallin/tini
ln -s $(pwd) GO/src/github.com/docker/docker
2019-08-14 15:38:32 +03:00
export DOCKER_GITCOMMIT="%{shortcommit}"
2024-04-10 20:04:25 +00:00
export DOCKER_CLI_EXPERIMENTAL=enabled
export TMP_GOPATH="$(pwd)/GO"
export GOPATH=%{gopath}:"$(pwd)/GO"
export GO111MODULE=off
# docker-init
cd tini
%cmake
%make_build tini-static
cd ../..
2019-08-14 15:38:32 +03:00
# dockerd
2024-04-10 20:04:25 +00:00
DOCKER_BUILDTAGS='selinux seccomp journald' VERSION=%{moby_version} hack/make.sh dynbinary
# docker-proxy
cd libnetwork
go build -ldflags='-linkmode=external' github.com/docker/libnetwork/cmd/proxy
cd ..
# cli
cd cli-%{version}
DISABLE_WARN_OUTSIDE_CONTAINER=1 make VERSION=%{moby_version} LDFLAGS="-linkmode=external" dynbinary
cd ..
2024-05-18 13:02:56 +00:00
# buildx
# buildx move to docker-buildx package
2017-09-11 14:46:27 +03:00
2015-06-25 14:54:37 +03:00
%install
2019-08-14 15:38:32 +03:00
# install binaries
2015-06-25 14:54:37 +03:00
install -d %{buildroot}%{_bindir}
2024-04-10 20:04:25 +00:00
install -p -m 755 cli-%{version}/build/docker-linux-* %{buildroot}%{_bindir}/docker
2019-08-14 15:38:32 +03:00
install -d %{buildroot}%{_sbindir}
2024-04-10 20:04:25 +00:00
install -p -m 755 bundles/dynbinary-daemon/dockerd %{buildroot}%{_sbindir}/dockerd
install -p -m 755 libnetwork/proxy %{buildroot}%{_bindir}/docker-proxy
install -p -m 755 tini/build/tini-static %{buildroot}%{_bindir}/docker-init
2024-05-18 13:02:56 +00:00
install -d %{buildroot} %{_dockerpluginsdir}
install -Dm0755 buildx/buildx %{buildroot} %{_dockerpluginsdir}/docker-buildx
2015-06-25 14:54:37 +03:00
# Place to store images
2024-04-10 20:04:25 +00:00
install -d %{buildroot}%{_var}/lib/docker
install -d %{buildroot}%{_sysconfdir}/docker
# (tpg) we are using nftables
# (bero) but for reasons yet to be determined, that prevents containers
# from having net access -- allow them to keep using iptables for now
cat > %{buildroot}%{_sysconfdir}/docker/daemon.json << 'EOF'
{
2024-05-17 21:33:26 +00:00
"iptables": true,
"default-runtime": "crun",
"runtimes": {
"crun": {
"path": "/usr/bin/crun"
}
}
2024-04-10 20:04:25 +00:00
}
EOF
install -D -p -m 755 %{SOURCE14} %{buildroot}%{_sysconfdir}/nftables/%{name}.nft
2015-06-25 14:54:37 +03:00
# install bash completion
install -d %{buildroot}%{_sysconfdir}/bash_completion.d
2024-04-10 20:04:25 +00:00
install -p -m 644 cli-%{version}/contrib/completion/bash/docker %{buildroot}%{_sysconfdir}/bash_completion.d/docker.bash
# install zsh completion
install -d %{buildroot}%{_datadir}/zsh/site-functions
install -p -m 644 cli-%{version}/contrib/completion/zsh/_docker %{buildroot}%{_datadir}/zsh/site-functions
2016-06-17 18:03:06 +03:00
# 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
2024-04-10 20:04:25 +00:00
install -p -m 644 cli-%{version}/contrib/completion/fish/%{repo}.fish %{buildroot}%{_datadir}/fish/vendor_completions.d
2016-06-17 18:03:06 +03:00
2015-06-25 14:54:37 +03:00
# install udev rules
install -d %{buildroot}%{_udevrulesdir}
2024-04-10 20:04:25 +00:00
install -p -m 644 contrib/udev/80-docker.rules %{buildroot}%{_udevrulesdir}
2015-06-25 14:54:37 +03:00
# install storage dir
2024-04-10 20:04:25 +00:00
install -d -m 700 %{buildroot}%{_var}/lib/docker
2015-06-25 14:54:37 +03:00
# install systemd/init scripts
install -d %{buildroot}%{_unitdir}
2019-08-14 15:38:32 +03:00
install -p -m 644 %{SOURCE1} %{SOURCE7} %{buildroot}%{_unitdir}
2015-06-25 14:54:37 +03:00
2019-08-14 15:38:32 +03:00
# for additional args
install -d %{buildroot}%{_sysconfdir}/sysconfig/
2024-04-10 20:04:25 +00:00
install -p -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{repo}
install -p -m 644 %{SOURCE6} %{buildroot}%{_sysconfdir}/sysconfig/%{repo}-network
install -p -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/%{repo}-storage
2015-06-25 14:54:37 +03:00
2019-08-14 15:38:32 +03:00
#network cleanup
install -d %{buildroot}%{_sbindir}
2024-04-10 20:04:25 +00:00
install -p -m 755 %{SOURCE8} %{buildroot}%{_sbindir}/docker-network-cleanup
2017-09-11 14:46:27 +03:00
install -d %{buildroot}%{_presetdir}
2024-04-10 20:04:25 +00:00
cat > %{buildroot}%{_presetdir}/86-docker.preset << EOF
enable docker.socket
2017-09-11 14:46:27 +03:00
EOF
2019-08-14 15:38:32 +03:00
install -d %{buildroot}%{_sysconfdir}/modules-load.d/
install -p -m 644 %{SOURCE9} %{buildroot}%{_sysconfdir}/modules-load.d/overlay.conf
2024-04-10 20:04:25 +00:00
install -Dpm 644 %{SOURCE4} %{buildroot}%{_sysusersdir}/%{name}.conf
#%%check
# This is completely unstable so I deactivate it for now.
#[ ! -w /run/%{repo}.sock ] || {
#mkdir test_dir
#pushd test_dir
#git clone https://github.com/lsm5/docker.git -b fedora-1.10
#pushd %{repo}
#make test
#popd
#popd
#}
%pre
%sysusers_create_package %{name} %{SOURCE4}
%post
%systemd_post docker
if [ -e %{_sysconfdir}/sysconfig/nftables.conf ] && ! grep -q docker.nft %{_sysconfdir}/sysconfig/nftables.conf; then
printf '%s\n' 'include "/etc/nftables/docker.nft"' >> %{_sysconfdir}/sysconfig/nftables.conf
fi
%preun
%systemd_preun docker
%postun
%systemd_postun_with_restart docker
if [ $1 == 0 ] && [ -e %{_sysconfdir}/sysconfig/nftables.conf ]; then
sed -i -e '/docker\.nft/d' %{_sysconfdir}/sysconfig/nftables.conf
fi
%files
%config(noreplace) %{_sysconfdir}/sysconfig/%{repo}
%config(noreplace) %{_sysconfdir}/sysconfig/%{repo}-network
%config(noreplace) %{_sysconfdir}/sysconfig/%{repo}-storage
%{_sysusersdir}/%{name}.conf
%dir %{_sysconfdir}/docker
%config(noreplace) %{_sysconfdir}/docker/daemon.json
%config(noreplace) %{_sysconfdir}/nftables/%{name}.nft
%{_bindir}/docker
%{_bindir}/docker-proxy
%{_bindir}/docker-init
%{_sbindir}/docker-network-cleanup
%{_sbindir}/dockerd
%{_presetdir}/86-docker.preset
%{_unitdir}/docker.service
%{_unitdir}/docker.socket
%dir %{_sysconfdir}/bash_completion.d
%{_sysconfdir}/bash_completion.d/docker.bash
%dir %{_var}/lib/docker
%dir %{_udevrulesdir}
%{_udevrulesdir}/80-docker.rules
%{_sysconfdir}/modules-load.d/overlay.conf
%files fish-completion
%dir %{_datadir}/fish/vendor_completions.d/
%{_datadir}/fish/vendor_completions.d/%{repo}.fish
%files zsh-completion
%{_datadir}/zsh/site-functions/_%{repo}