aboutsummaryrefslogtreecommitdiffstats
path: root/community/docker/APKBUILD
blob: 211cd791abfccc6da1572cb65c88981ea5151a04 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=docker
pkgver=17.05.0
_ver=${pkgver/_/-}-ce
pkgrel=0
_gitcommit=v$_ver
pkgdesc="Pack, ship and run any application as a lightweight container"
url="http://www.docker.io/"
arch="all !s390x"
license="ASL 2.0"
depends="ca-certificates iptables"
depends_dev=""
makedepends="go btrfs-progs-dev bash linux-headers coreutils libseccomp-dev cmake lvm2-dev glide"
options="!check"
install="$pkgname.pre-install"

# $ grep COMMIT hack/dockerfile/binaries-commits
# TOMLV_COMMIT=9baf8a8a9f2ed20a8e54160840c492f937eeaf9a
# RUNC_COMMIT=9c2d8d184e5da67c95d601382adf14862e4f2228
# CONTAINERD_COMMIT=9048e5e50717ea4497b757314bad98ea3763c145
# TINI_COMMIT=949e6facb77383876aeff8a6944dde66b3089574
# LIBNETWORK_COMMIT=7b2b1feb1de4817d522cc372af149ff48d25028e
# VNDR_COMMIT=19220953c4a45310a4c404b7905154e29120249e
# BINDATA_COMMIT=a0ff2567cfb70903282db057e799fd826784d41d

_runc_ver=9c2d8d184e5da67c95d601382adf14862e4f2228
_containerd_ver=9048e5e50717ea4497b757314bad98ea3763c145
_libnetwork_ver=7b2b1feb1de4817d522cc372af149ff48d25028e
_tini_ver=949e6facb77383876aeff8a6944dde66b3089574

subpackages="
	$pkgname-bash-completion:bashcomp:noarch
	$pkgname-fish-completion:fishcomp:noarch
	$pkgname-zsh-completion:zshcomp:noarch
	$pkgname-vim:vim:noarch
	$pkgname-doc
	"
source="
	moby-$pkgver.tar.gz::https://github.com/moby/moby/archive/v$_ver.tar.gz
	runc-$_runc_ver.tar.gz::https://github.com/opencontainers/runc/archive/$_runc_ver.tar.gz
	containerd-$_containerd_ver.tar.gz::https://github.com/docker/containerd/archive/$_containerd_ver.tar.gz
	libnetwork-$_libnetwork_ver.tar.gz::https://github.com/docker/libnetwork/archive/$_libnetwork_ver.tar.gz
	tini-$_tini_ver.tar.gz::https://github.com/krallin/tini/archive/$_tini_ver.tar.gz
	docker-openrc-fixes.patch
	tini-cmake-fixes.patch
	docker-openrc-busybox-ash.patch
	"

builddir="$srcdir"/moby-$_ver
#_buildtags="exclude_graphdriver_aufs exclude_graphdriver_devicemapper"
_buildtags=""
_runc_buildtags="seccomp"
_runc_builddir="$srcdir"/runc-$_runc_ver

_containerd_builddir="$srcdir"/containerd-$_containerd_ver
_libnetwork_builddir="$srcdir"/libnetwork-$_libnetwork_ver
_tini_builddir="$srcdir"/tini-$_tini_ver

_apply_patches() {
	local _dir="$1"
	local _prefix="$2"
	local i
	msg "applying patches for $_prefix"
	cd "$_dir"
	for i in $source; do
		case $i in
		${_prefix}-*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

prepare() {
	_apply_patches "$builddir" docker || return 1
	_apply_patches "$_runc_builddir" runc || return 1
	_apply_patches "$_tini_builddir" tini || return 1
}

build() {
	cd "$_runc_builddir"


	cd "$builddir"

	export AUTO_GOPATH=1
	export DOCKER_GITCOMMIT=$_gitcommit
	export DOCKER_BUILDTAGS=$_buildtags
	unset CC # prevent possible ccache issues

	# containerd
	msg "building containerd"
	cd "$_containerd_builddir" || return 1
	mkdir -p src/github.com/docker/
	ln -s "$_containerd_builddir" src/github.com/docker/containerd
	GOPATH="$PWD" LDFLAGS="" make GIT_COMMIT="$_containerd_ver" || return 1

	# libnetwork (docker-proxy)
	msg "building docker-proxy"
	cd "$_libnetwork_builddir" || return 1
	mkdir -p src/github.com/docker/
	ln -s "$_libnetwork_builddir" src/github.com/docker/libnetwork
	GOPATH="$PWD" go build -v -ldflags="-linkmode=external" -o docker-proxy github.com/docker/libnetwork/cmd/proxy || return 1

	# runc
	msg "building runc"
	cd "$_runc_builddir" || return 1
	GOPATH="$PWD" make COMMIT="$_runc_ver" || return 1

	# tini
	msg "building tini"
	cd "$_tini_builddir" || return 1
	cmake -DVERSION_GIT=$_tini_ver || return 1
	make tini-static|| return 1

	# docker
	msg "building docker"
	cd "$builddir"
	./hack/make.sh dynbinary

	# docker man
	msg "building docker man pages"
	cd "$builddir/man"
	mkdir -p genman
	cp glide.lock glide.yaml genman/
	cd genman
	# need empty src folder for glide
	mkdir src
	GOPATH=`pwd` glide install
	rmdir src && mv vendor src
	mkdir -p src/github.com/docker
	ln -s `pwd`/../../ src/github.com/docker/docker
	cd src/github.com/docker/docker
	GOPATH="$builddir/man/genman" go build -o man/gen-manpages ./man

	msg "Generating man pages"
	cd "$builddir/man"
	mkdir -p man1
	./gen-manpages --root $builddir --target ./man1
}

package() {
	cd "$builddir"
	local ver=$(cat VERSION)

	install -Dm755 bundles/$ver/dynbinary-client/docker-$ver \
		"$pkgdir"/usr/bin/docker || return 1

	install -Dm755 bundles/$ver/dynbinary-daemon/dockerd-$ver \
		"$pkgdir"/usr/bin/dockerd || return 1

	install -Dm755 "$_libnetwork_builddir"/docker-proxy \
		"$pkgdir"/usr/bin/docker-proxy || return 1

	install -Dm755 "$_runc_builddir"/runc \
		"$pkgdir"/usr/bin/docker-runc || return 1

	install -Dm755 "$_containerd_builddir"/bin/containerd \
		"$pkgdir"/usr/bin/docker-containerd || return 1

	install -Dm755 "$_containerd_builddir"/bin/containerd-shim \
		"$pkgdir"/usr/bin/docker-containerd-shim || return 1

	install -Dm755 "$_containerd_builddir"/bin/ctr \
		"$pkgdir"/usr/bin/docker-containerd-ctr || return 1

	install -Dm755 "$_tini_builddir"/tini-static \
		"$pkgdir"/usr/bin/docker-init || return 1

	install -Dm755 contrib/init/openrc/docker.initd \
		"$pkgdir"/etc/init.d/docker || return 1
	install -Dm644 contrib/init/openrc/docker.confd \
		"$pkgdir"/etc/conf.d/docker || return 1

	mkdir -p "$pkgdir"/usr/share/man/man1
	install -Dm644 man/man1/* \
		"$pkgdir"/usr/share/man/man1 || return 1
}

bashcomp() {
	pkgdesc="Bash completion for Docker"
	depends=""
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

	install -Dm644 "$builddir"/contrib/completion/bash/$pkgname \
		"$subpkgdir"/usr/share/bash-completion/completions/$pkgname
}

fishcomp() {
	pkgdesc="Fish shell completion for Docker"
	depends=""
	install_if="$pkgname=$pkgver-r$pkgrel fish"

	install -Dm644 "$builddir"/contrib/completion/fish/$pkgname.fish \
		"$subpkgdir"/usr/share/fish/completions/$pkgname.fish || return 1
}

zshcomp() {
	pkgdesc="Zsh completion for $pkgname"
	depends=""
	install_if="$pkgname=$pkgver-r$pkgrel zsh"

	install -Dm644 "$builddir"/contrib/completion/zsh/_$pkgname \
		"$subpkgdir"/usr/share/zsh/site-functions/_$pkgname || return 1
}

vim() {
	depends=""
	pkgdesc="Vim syntax for Docker"

	local f=
	for f in ftdetect/dockerfile.vim syntax/dockerfile.vim; do
		install -Dm644 "$builddir"/contrib/syntax/vim/$f \
			"$subpkgdir"/usr/share/vim/vimfiles/$f
	done
}

sha512sums="9d4fea1d6ce2ca3d65e6d2e6d2a0629ec0dbbc3397088ffb1e608b31d705a380356df0b23bb87b86ef51660e5196beffc90602bf59d8c5138c0e4f906fafe441  moby-17.05.0.tar.gz
225a37b4a3a79ff0d7a3e74b997f6e5547e270d02c58e65ccb5ea2d81771c489378727bd6abf2f445ea94c2e7717e2991da9fb4cab74327fd57c0e6218143cc3  runc-9c2d8d184e5da67c95d601382adf14862e4f2228.tar.gz
b7d56adaac26c9f0fd0900467fb5f8500472b602d7ce2373704c08ae6a0b852051e469a4fa51c8db475499872a51fcdd65c2adc4124102e66b8ca86cc5b2ff2f  containerd-9048e5e50717ea4497b757314bad98ea3763c145.tar.gz
6bd82d64d2847a01feb6004ad180f77e767d4a27ca742a66c411f2824f50ca4439974010e32a18a6b03bc1f6186ee7a7c5f86f6c9cbbd8c275fb7fdd345b7bc1  libnetwork-7b2b1feb1de4817d522cc372af149ff48d25028e.tar.gz
b6c1454f734662adf2fdedcb75cb7cdc82f4cf5b4c41fadf6891a670fa26d49b789034f4af8bf920b9e1ff1c3536123637ade9471f4ae2c1ef6c534e839b9f27  tini-949e6facb77383876aeff8a6944dde66b3089574.tar.gz
8296b1bc88ef3dec4f9038c4e0bf83120ac5870860f6662eac9f9f8850ea8b7596bcd2b47932551e804ae8b6f6f26ad3bc4ce6d49600cc8eaf0a3016c15a9ccf  docker-openrc-fixes.patch
29a343848d0aa14864c6bfc87c2a6fd408f546f0114e12f7035fb4678ee769fe728872a5d283803177990a61d7e02c4916017d5e45380ad3b0a2dffa3e746857  tini-cmake-fixes.patch
9b24dc0c50904c3d12bb04c1a7df169651043ddbc258018647010a5aa01d8a19ad54d10ca79dce6d6283c81f4fa0cc8de417f6180dd824c5a588b22b23546cb5  docker-openrc-busybox-ash.patch"