aboutsummaryrefslogtreecommitdiffstats
path: root/testing/dockerize/APKBUILD
blob: 3d331186fb01f413b28ab95694ce123e7cd71b33 (plain)
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
# Maintainer: Christian Kampka <christian@kampka.net>
pkgname=dockerize
pkgver=0.2.0
pkgrel=0
pkgdesc="Utility to simplify running applications in docker containers."
url="https://github.com/jwilder/dockerize"
arch="x86 x86_64"
license="MIT"
makedepends="git go"
options="!strip"
source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-$pkgver.tar"

_giturl="git://github.com/jwilder/${pkgname}.git"
_disturl="dev.alpinelinux.org:/archive/$pkgname/"


snapshot() {
	abuild clean
	abuild deps

	mkdir -p "$srcdir"
	cd "$srcdir"

	# dockerize utilizes glock for dependency resolution,
	# but we don't want to provide glock as a package since
	# it does not do stable releases.
	# Therefore, we build it here to resolve the dependencies
	# for the dockerize snapshot.
	_glock_giturl="git://github.com/robfig/glock.git"
	_glock_commit="e75a83a850fe9ff13fd63720d09d28aab795808e"

	export GOPATH="${srcdir}/glock"
	git clone -q ${_glock_giturl} || return 1
	cd "${srcdir}/glock"
	git checkout -q ${_glock_commit} || return 1
	go get -v -d || return 1
	go build || return 1
	GLOCK_BIN="${srcdir}/glock/glock"

	# now prepare the dockerize snapshot

	cd "$srcdir"
	msg "Creating snapshot: $_pkg"
	export GOPATH="${srcdir}/$pkgname"
	git clone -q ${_giturl} ${pkgname}|| return 1
	cd $pkgname
	git checkout -q v${pkgver} || return 1
	"$GLOCK_BIN" sync ../ || return 1
	cd $srcdir
	tar cf $pkgname-$pkgver.tar $pkgname || return 1
	rsync --progress -La $pkgname-${pkgver}.tar \
		$_disturl || return 1
	cd $startdir
	abuild checksum
	abuild undeps
}

_builddir="${srcdir}/${pkgname}"

prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
	GOARCH=$(go env | grep GOARCH | cut -d'=' -f 2 | xargs echo -n)
	export GOPATH="$_builddir"
	mkdir -p ${_builddir}/dist/linux/$GOARCH
	GOOS=linux go build -ldflags "-X main.buildVersion ${pkgver}" -o ${_builddir}/dist/linux/$GOARCH/dockerize
}

package() {
	cd "$_builddir"
	GOARCH=$(go env | grep GOARCH | cut -d'=' -f 2 | xargs echo -n)
	install -Dm755 ${_builddir}/dist/linux/$GOARCH/dockerize \
	"$pkgdir"/usr/bin/dockerize
}
md5sums="5b08bbbec896e704c5f9b1e949889953  dockerize-0.2.0.tar"
sha256sums="75f7727d4e09b0adcaa0670db640692a2a083f20417ff039d9a4dce457d7665f  dockerize-0.2.0.tar"
sha512sums="93889175a5291259f8b2893080d70e1aa98a67777485a4dd51dfb3ab8100a47553669f21e6cce55addc6ece6956f3d01ffca94017cead3497198a7c35a85e971  dockerize-0.2.0.tar"