forked from box-builder/box
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rb
76 lines (60 loc) · 2.13 KB
/
build.rb
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
from "debian"
after { tag "erikh/box:master" }
DOCKER_VERSION = "1.13.1"
GOLANG_VERSION = "1.7.5"
LVM2_VERSION = "2.02.103"
GPGME_VERSION = "1.8.0"
PACKAGES = %w[
libgpg-error-dev
libassuan-dev
btrfs-tools
build-essential
g++
git
wget
curl
ruby
bison
flex
iptables
psmisc
python2.7
btrfs-tools
]
qq = getenv("CI_BUILD") != "" ? "-qq" : ""
skip do
workdir "/"
run "apt-get update #{qq}"
run "apt-get install -y #{qq} #{PACKAGES.join(" ")}"
run "mkdir -p /usr/local/gpgme && curl -sSL https://www.gnupg.org/ftp/gcrypt/gpgme/gpgme-#{GPGME_VERSION}.tar.bz2 | tar -xjC /usr/local/gpgme --strip-components=1"
run "cd /usr/local/gpgme && ./configure --enable-static && PREFIX=/usr make install"
# shamelessly taken from docker
run %Q[mkdir -p /usr/local/lvm2 \
&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.#{LVM2_VERSION}.tgz" \
| tar -xzC /usr/local/lvm2 --strip-components=1]
# See https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
# Compile and install lvm2
run %q[cd /usr/local/lvm2 \
&& ./configure \
--build="$(gcc -print-multiarch)" \
--enable-static_link \
&& make device-mapper \
&& make install_device-mapper]
docker_path = "docker-#{DOCKER_VERSION}.tgz"
run "wget -q https://get.docker.com/builds/Linux/x86_64/#{docker_path}"
run "tar -xpf #{docker_path} --strip-components=1 -C /usr/bin/"
run "rm #{docker_path}"
run "curl -sSL https://storage.googleapis.com/golang/go#{GOLANG_VERSION}.linux-amd64.tar.gz | tar -xz -C /usr/local"
copy "dind", "/dind"
run "curl -sSL https://bootstrap.pypa.io/get-pip.py | python2.7"
run "pip -q install mkdocs mkdocs-bootswatch"
env "PATH" => "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/go/bin:/go/bin", "GOPATH" => "/go"
copy ".", "/go/src/github.com/erikh/box"
run "cd /go/src/github.com/erikh/box && VERSION=#{getenv("VERSION")} make clean install-static"
workdir "/go/src/github.com/erikh/box"
set_exec entrypoint: ["/dind"], cmd: %w[make docker-test]
tag "box-test"
end
run "mv /go/bin/box /box"
workdir "/"
set_exec entrypoint: ["/box"], cmd: []