aboutsummaryrefslogtreecommitdiffstats
path: root/community/docker/APKBUILD
blob: e39f53c4a2d17c1ed9ac7123b40494cbd0a4c3ba (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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
# Contributor: Bernhard J. M. Gruen <bernhard.gruen@googlemail.com>
pkgname=docker
pkgver=18.03.1
_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"
license="Apache-2.0"
depends="ca-certificates iptables"
makedepends="go btrfs-progs-dev bash linux-headers coreutils libseccomp-dev cmake lvm2-dev libtool"
options="!check"
install="$pkgname.pre-install"

# from "$srcdir"/docker-ce-"$_ver"-ce/components/engine/hack/dockerfile/install/*.installer
_runc_ver=4fc53a81fb7c994640722ac585fa9ca548971871
_containerd_ver=773c489c9c1b21a6d78b5c538cd395416ec50f88
_tini_ver=949e6facb77383876aeff8a6944dde66b3089574
_libnetwork_ver=c15b372ef22125880d378167dde44f4b134e1a77

_cobra_ver="0.0.2"
_go_md2man_ver="1.0.8"

subpackages="
	$pkgname-bash-completion:bashcomp:noarch
	$pkgname-fish-completion:fishcomp:noarch
	$pkgname-zsh-completion:zshcomp:noarch
	$pkgname-vim:vim:noarch
	$pkgname-doc
	"

source="
	docker-$pkgver.tar.gz::https://github.com/docker/docker-ce/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/containerd/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
	go-md2man-$_go_md2man_ver.tar.gz::https://github.com/cpuguy83/go-md2man/archive/v$_go_md2man_ver.tar.gz
	cobra-$_cobra_ver.tar.gz::https://github.com/spf13/cobra/archive/v$_cobra_ver.tar.gz
	docker-openrc-fixes.patch
	tini-cmake-fixes.patch
	docker-openrc-busybox-ash.patch
	"

_dockerdir="$srcdir"/docker-$_ver
_cli_builddir="$_dockerdir"/components/cli
_daemon_builddir="$_dockerdir"/components/engine
_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;;
		esac
	done
}

prepare() {
	# Rename 'docker-ce-VER' to 'docker-VER'
	mv "$srcdir"/docker-ce-$_ver "$_dockerdir"

	_apply_patches "$_daemon_builddir" docker
	_apply_patches "$_runc_builddir" runc
	_apply_patches "$_tini_builddir" tini
}

build() {
	export AUTO_GOPATH=1
	#export GOPATH="$srcdir"
	#export GOBIN="$GOPATH"/bin
	#export PATH="$GOBIN:$PATH"
	export DOCKER_GITCOMMIT=$_gitcommit
	export DOCKER_BUILDTAGS=$_buildtags
	unset CC # prevent possible ccache issues

	# containerd
	msg "building containerd"
	cd "$_containerd_builddir"
	# Vendor dir only works if it's part of a package in the src dir. Easiest solution is to make it a src dir iself
	mv vendor src
	mkdir -p src/github.com/containerd/
	ln -s "$_containerd_builddir" src/github.com/containerd/containerd
	GOPATH="$PWD" LDFLAGS="" make GIT_COMMIT="$_containerd_ver"

	# libnetwork (docker-proxy)
	msg "building docker-proxy"
	cd "$_libnetwork_builddir"
	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

	# runc
	msg "building runc"
	cd "$_runc_builddir"
	mkdir -p src/github.com/opencontainers/
	ln -s "$_runc_builddir" src/github.com/opencontainers/runc
	cd src/github.com/opencontainers/runc
	GOPATH="$PWD" make COMMIT="$_runc_ver"

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

	# daemon
	msg "building daemon"
	cd "$_daemon_builddir"
	mkdir -p src/github.com/docker/
	ln -s "$_daemon_builddir" src/github.com/docker/docker
	GOPATH="$PWD" VERSION="$_ver" hack/make.sh dynbinary

	# Required for building man-pages
	export GOPATH="$_cli_builddir"
	export GOBIN="$GOPATH/bin"
	export PATH="$GOBIN:$PATH"

	# cli
	msg "building cli"
	cd "$_cli_builddir"
	mkdir -p "$GOPATH"/src/github.com/docker/
	ln -s "$_cli_builddir" "$GOPATH"/src/github.com/docker/cli
	LDFLAGS="" make VERSION="$_ver" dynbinary

	# docker man
	msg "building docker man pages"
	cd "$srcdir"
	# cobra
	mkdir -p "$GOPATH"/src/github.com/spf13/
	ln -sf "$PWD"/cobra-$_cobra_ver "$GOPATH"/src/github.com/spf13/cobra
	# md2man
	mkdir -p "$GOPATH"/src/github.com/cpuguy83/
	ln -s "$PWD"/go-md2man-$_go_md2man_ver "$GOPATH"/src/github.com/cpuguy83/go-md2man
	cd "$GOPATH"/src/github.com/cpuguy83/go-md2man
	go get

	# convert md to man pages
	msg "generating man pages"
	cd "$_cli_builddir"
	make manpages
}

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

	# 'build/docker' is a symlink to 'docker-linux-$arch' e.g. 'docker-linux-amd64'
	install -Dm755 "$_cli_builddir"/build/docker \
		"$pkgdir"/usr/bin/docker

#	install -Dm755 "$_daemon_builddir"/bundles/$ver/dynbinary-daemon/dockerd-$ver \
	install -Dm755 "$_daemon_builddir"/bundles/dynbinary-daemon/dockerd-$ver \
		"$pkgdir"/usr/bin/dockerd

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

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

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

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

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

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

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

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

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

	install -Dm644 "$_cli_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 "$_cli_builddir"/contrib/completion/fish/$pkgname.fish \
		"$subpkgdir"/usr/share/fish/completions/$pkgname.fish
}

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

	install -Dm644 "$_cli_builddir"/contrib/completion/zsh/_$pkgname \
		"$subpkgdir"/usr/share/zsh/site-functions/_$pkgname
}

vim() {
	depends=""
	pkgdesc="Vim syntax for $pkgname"
	install_if="vim $pkgname=$pkgver-r$pkgrel"

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

sha512sums="48c4916421cd500ada1bfc2207123a29870939a15a1c7c4a0c082f61c1e3e063381e2345ee9df645dbaca49e002dbfaba70cf6fe233b39a4e1f44fb015807e10  docker-18.03.1.tar.gz
f7d765c6d0a24adf1030cb41d71ce532f2f5b3dd4c05c48aaa6eb37604c3854cc3a463aff19defc7c259564e237ef30f7e39d4787dad0ee42bb534c3d65946c0  runc-4fc53a81fb7c994640722ac585fa9ca548971871.tar.gz
a9833beac55f388acf90cd657755f7752e90eb396be6080570e184e23c5e96e9c3d7632f5e256178417c964457cb58b49b6e531d9844feecf2043ae6d200e93a  containerd-773c489c9c1b21a6d78b5c538cd395416ec50f88.tar.gz
300e197313017536f91768ba675f2ab773eb1914f8e5908f4ff5b6fc8c4f0fa5ba1653cd9f8ca26e7c466f1623716aa45a2746f862e47ca9fe9136010085f600  libnetwork-c15b372ef22125880d378167dde44f4b134e1a77.tar.gz
b6c1454f734662adf2fdedcb75cb7cdc82f4cf5b4c41fadf6891a670fa26d49b789034f4af8bf920b9e1ff1c3536123637ade9471f4ae2c1ef6c534e839b9f27  tini-949e6facb77383876aeff8a6944dde66b3089574.tar.gz
4c52e01c9b07582b5d55d1e94935378a676bd284a3e8230a8a191d4678b1b6ae92b704a249117c542832170069a70c649e58a1752fb2973709259b5bc108db91  go-md2man-1.0.8.tar.gz
2ff7dcc8275d2a2619f1dc8bcb890af42a9695a922fe408782b457e8e940ce32976f030c897170bfa7ee01ca22cb11b6ab74ef7da9da578baa9f494c2e93c573  cobra-0.0.2.tar.gz
33155a79799cc6c0520a030e1a9bdba60441776d612e5e255574b23bbce1c7a8e5d868284b05a8a92704be6bbb7db905388564e867986a705acbe4884ac58584  docker-openrc-fixes.patch
29a343848d0aa14864c6bfc87c2a6fd408f546f0114e12f7035fb4678ee769fe728872a5d283803177990a61d7e02c4916017d5e45380ad3b0a2dffa3e746857  tini-cmake-fixes.patch
9b24dc0c50904c3d12bb04c1a7df169651043ddbc258018647010a5aa01d8a19ad54d10ca79dce6d6283c81f4fa0cc8de417f6180dd824c5a588b22b23546cb5  docker-openrc-busybox-ash.patch"