diff --git a/sakamoto/docker-without-libnetwork/APKBUILD b/sakamoto/docker-without-libnetwork/APKBUILD new file mode 100644 index 0000000..43b568d --- /dev/null +++ b/sakamoto/docker-without-libnetwork/APKBUILD @@ -0,0 +1,204 @@ +# Contributor: Eivind Uggedal +# Contributor: Patrycja Rosa +# Maintainer: Jake Buchholz +pkgname=docker-without-libnetwork +pkgver=20.10.5 +_cli_commit=55c4c88966a912ddb365e2d73a4969e700fc458f # https://github.com/docker/cli/commits/v$pkgver +_moby_commit=363e9a88a11be517d9e8c65c998ff56f774eb4dc # https://github.com/moby/moby/commits/v$pkgver +pkgrel=0 +pkgdesc="Pack, ship and run any application as a lightweight container" +url="https://www.docker.io/" +arch="all" +license="Apache-2.0" +depends="docker-engine docker-cli" +makedepends="go go-md2man btrfs-progs-dev bash linux-headers coreutils lvm2-dev libtool libseccomp-dev" +install="$pkgname.pre-install" + +# from https://github.com/moby/moby: grep libnetwork vendor.conf +_libnetwork_commit=fa125a3512ee0f6187721c88582bf8c4378bd4d7 +# from https://github.com/docker/cli: grep cobra vendor.conf +_cobra_ver="1.1.1" + +# secfixes: +# 20.10.3-r0: +# - CVE-2021-21285 +# - CVE-2021-21284 +# 19.03.14-r0: +# - CVE-2020-15257 +# 19.03.11-r0: +# - CVE-2020-13401 +# 19.03.1-r0: +# - CVE-2019-14271 +# 18.09.8-r0: +# - CVE-2019-13509 +# 18.09.7-r0: +# - CVE-2018-15664 + +subpackages=" + $pkgname-engine:engine + $pkgname-openrc:engine_openrc:noarch + $pkgname-cli:cli + $pkgname-doc:cli_doc:noarch + $pkgname-bash-completion:cli_bashcomp:noarch + $pkgname-fish-completion:cli_fishcomp:noarch + $pkgname-zsh-completion:cli_zshcomp:noarch + " + +source=" + cli-$pkgver.tar.gz::https://github.com/docker/cli/archive/v$pkgver.tar.gz + moby-$pkgver.tar.gz::https://github.com/moby/moby/archive/v$pkgver.tar.gz + libnetwork-$_libnetwork_commit.tar.gz::https://github.com/docker/libnetwork/archive/$_libnetwork_commit.tar.gz + cobra-$_cobra_ver.tar.gz::https://github.com/spf13/cobra/archive/v$_cobra_ver.tar.gz + docker.initd + docker.confd + " + +_cli_builddir="$srcdir/cli-$pkgver" +_moby_builddir="$srcdir/moby-$pkgver" +_libnetwork_builddir="$srcdir/libnetwork-$_libnetwork_commit" + +_buildtags="seccomp" + +case $CARCH in + mips64) + export GOFLAGS="${GOFLAGS/-buildmode=pie}" # Docker does not supprt buildmode=pie on mips64 + ;; +esac + +export GO111MODULE=off # go1.16 defaults to on + +build() { + export AUTO_GOPATH=1 + export GITCOMMIT=$_cli_commit # for cli + export DOCKER_GITCOMMIT=$_moby_commit # for moby + export DOCKER_BUILDTAGS=$_buildtags + export DISABLE_WARN_OUTSIDE_CONTAINER=1 + unset CC # prevent possible ccache issues + + case "$CARCH" in + armv7) export GOARM=7;; + esac + + # libnetwork (docker-proxy) + msg "building docker-proxy" + cd "$_libnetwork_builddir" + mkdir -p src/github.com/docker/ + ln -sf "$_libnetwork_builddir" src/github.com/docker/libnetwork + GOPATH="$PWD" go build -v -ldflags="-linkmode=external" -o docker-proxy github.com/docker/libnetwork/cmd/proxy + + # engine (moby) + msg "building engine" + cd "$_moby_builddir" + + sed -i -E 's@WithLibnetwork\(daemon,@//&@' daemon/oci_linux.go + + mkdir -p src/github.com/docker/ + ln -sf "$_moby_builddir" src/github.com/docker/docker + GOPATH="$PWD" VERSION="$pkgver" hack/make.sh dynbinary + + # Required for building man-pages + export GOPATH="$_cli_builddir" + export GOBIN="$GOPATH/bin" + export PATH="$GOBIN:$PATH" + # go-md2man package installs go-md2man, but this looks for md2man + if ! command -v md2man &> /dev/null; then + mkdir -p /tmp/bin + ln -sf /usr/bin/go-md2man /tmp/bin/md2man + export PATH="/tmp/bin:$PATH" + fi + + # cli + msg "building cli" + cd "$_cli_builddir" + mkdir -p "$GOPATH"/src/github.com/docker/ + ln -sf "$_cli_builddir" "$GOPATH"/src/github.com/docker/cli + LDFLAGS="" make VERSION="$pkgver" dynbinary + + # docker man + msg "building docker man pages" + mkdir -p "$GOPATH"/src/github.com/spf13/ + ln -sf "$srcdir/cobra-$_cobra_ver" "$GOPATH"/src/github.com/spf13/cobra + make manpages +} + +# docker itself is a meta package +package() { + mkdir -p "$pkgdir" +} + +engine() { + pkgdesc="Docker Engine (dockerd)" + depends="ca-certificates containerd iptables ip6tables tini-static" + + install -Dm755 "$_moby_builddir"/bundles/dynbinary-daemon/dockerd \ + "$subpkgdir"/usr/bin/dockerd + + install -Dm755 "$_libnetwork_builddir"/docker-proxy \ + "$subpkgdir"/usr/bin/docker-proxy + + # symlink externally provided tini-static binary + ln -sf /sbin/tini-static "$subpkgdir"/usr/bin/docker-init +} + +engine_openrc() { + pkgdesc="OpenRC init scripts for Docker" + depends="" + install_if="openrc $pkgname-engine=$pkgver-r$pkgrel" + + install -Dm755 "$srcdir"/docker.initd "$subpkgdir"/etc/init.d/docker + install -Dm644 "$srcdir"/docker.confd "$subpkgdir"/etc/conf.d/docker +} + +cli() { + pkgdesc="Docker CLI" + depends="ca-certificates" + + # 'build/docker' is a symlink to 'docker-linux-$arch' e.g. 'docker-linux-amd64' + install -Dm755 "$_cli_builddir"/build/docker \ + "$subpkgdir"/usr/bin/docker +} + +cli_doc() { + pkgdesc="Documentation for Docker" + depends="" + install_if="docs $pkgname-cli=$pkgver-r$pkgrel" + + mkdir -p "$subpkgdir"/usr/share/man/man1 + gzip -9 "$_cli_builddir"/man/man1/* + install -Dm644 "$_cli_builddir"/man/man1/* \ + "$subpkgdir"/usr/share/man/man1 +} + +cli_bashcomp() { + pkgdesc="Bash completion for Docker" + depends="" + install_if="bash-completion $pkgname-cli=$pkgver-r$pkgrel" + + install -Dm644 "$_cli_builddir"/contrib/completion/bash/docker \ + "$subpkgdir"/usr/share/bash-completion/completions/docker +} + +cli_fishcomp() { + pkgdesc="Fish shell completion for Docker" + depends="" + install_if="fish $pkgname-cli=$pkgver-r$pkgrel" + + install -Dm644 "$_cli_builddir"/contrib/completion/fish/docker.fish \ + "$subpkgdir"/usr/share/fish/completions/docker.fish +} + +cli_zshcomp() { + pkgdesc="Zsh completion for Docker" + depends="" + install_if="zsh $pkgname-cli=$pkgver-r$pkgrel" + + install -Dm644 "$_cli_builddir"/contrib/completion/zsh/_docker \ + "$subpkgdir"/usr/share/zsh/site-functions/_docker +} + +sha512sums="868e19fa834993bbd20a0d28a57f364287f39434355ccf90e63f3ead8d55fe488ac3bdab3f85230bfbede318b93513536f36da131fc17c27763a5375b4e0c636 cli-20.10.5.tar.gz +620a5345d99be16b4c6ba7321e91e4896128f7d638dfe2220554a6cadeb78b21dd3003cff6db60ed5ffd671ea243b310b21cc1123543b0e0cbfa93eec2900973 moby-20.10.5.tar.gz +dd583218fbeba8aeac2e4143369ad55a3e6c15d64f198f73e3656a80d0281a4374fb3be7bc05b01425461bf830762aa2c950da68ed0e3ae5884643e9d178c69e libnetwork-fa125a3512ee0f6187721c88582bf8c4378bd4d7.tar.gz +a27debc5c971f468e672826659e5c46946187e2307dded8c496084b9fabc5602e68bdfdc08f444f42d6f82f0f2704d01a0c4bde3e5fbe674c7cb14309f0a3328 cobra-1.1.1.tar.gz +e3a882a732f498ea62a770e1d91cfb910d4206156dd9a8546cf6af94dcb9c6201e0f712a86e3ad352fbae4f0eedb2b4055976af69385c671dc8e9a43b78bc31b docker.initd +f25523f43376ccef71a49618e556e0a16db3acad29eb09fe86c4e572562bdea0bc1eabab00159278835ad9d7c007f2cd10b2ed31f7213b0d9074582dc80a976f docker.confd" diff --git a/sakamoto/docker-without-libnetwork/docker-without-libnetwork.pre-install b/sakamoto/docker-without-libnetwork/docker-without-libnetwork.pre-install new file mode 100644 index 0000000..8cd2d63 --- /dev/null +++ b/sakamoto/docker-without-libnetwork/docker-without-libnetwork.pre-install @@ -0,0 +1,5 @@ +#!/bin/sh + +addgroup -S docker 2>/dev/null + +exit 0 diff --git a/sakamoto/docker-without-libnetwork/docker.confd b/sakamoto/docker-without-libnetwork/docker.confd new file mode 100644 index 0000000..f96e611 --- /dev/null +++ b/sakamoto/docker-without-libnetwork/docker.confd @@ -0,0 +1,26 @@ +# /etc/conf.d/docker: config file for /etc/init.d/docker + +# where the docker daemon output gets piped +# this contains both stdout and stderr. If you need to separate them, +# see the settings below +#DOCKER_LOGFILE="/var/log/docker.log" + +# where the docker daemon stdout gets piped +# if this is not set, DOCKER_LOGFILE is used +#DOCKER_OUTFILE="/var/log/docker-out.log" + +# where the docker daemon stderr gets piped +# if this is not set, DOCKER_LOGFILE is used +#DOCKER_ERRFILE="/var/log/docker-err.log" + +# Settings for process limits (ulimit) +#DOCKER_ULIMIT="-c unlimited -n 1048576 -u unlimited" + +# seconds to wait for sending SIGTERM and SIGKILL signals when stopping docker +#DOCKER_RETRY="TERM/60/KILL/10" + +# where the docker daemon itself is run from +#DOCKERD_BINARY="/usr/bin/dockerd" + +# any other random options you want to pass to docker +DOCKER_OPTS="" diff --git a/sakamoto/docker-without-libnetwork/docker.initd b/sakamoto/docker-without-libnetwork/docker.initd new file mode 100644 index 0000000..aa35285 --- /dev/null +++ b/sakamoto/docker-without-libnetwork/docker.initd @@ -0,0 +1,33 @@ +#!/sbin/openrc-run +supervisor=supervise-daemon + +name="Docker Daemon" +description="Persistent process that manages docker containers" +description_reload="Reload configuration without exiting" + +command="${DOCKERD_BINARY:-/usr/bin/dockerd}" +command_args="${DOCKER_OPTS}" +DOCKER_LOGFILE="${DOCKER_LOGFILE:-/var/log/${RC_SVCNAME}.log}" +DOCKER_ERRFILE="${DOCKER_ERRFILE:-${DOCKER_LOGFILE}}" +DOCKER_OUTFILE="${DOCKER_OUTFILE:-${DOCKER_LOGFILE}}" +supervise_daemon_args="--stderr \"${DOCKER_ERRFILE}\" --stdout \"${DOCKER_OUTFILE}\"" + +extra_started_commands="reload" + +rc_ulimit="${DOCKER_ULIMIT:--c unlimited -n 1048576 -u unlimited}" + +retry="${DOCKER_RETRY:-TERM/60/KILL/10}" + +depend() { + need sysfs cgroups +} + +start_pre() { + checkpath -f -m 0644 -o root:docker "$DOCKER_ERRFILE" "$DOCKER_OUTFILE" +} + +reload() { + ebegin "Reloading configuration" + $supervisor $RC_SVCNAME --signal HUP + eend $? +}