-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
72 lines (64 loc) · 3.2 KB
/
.travis.yml
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
sudo: required
language: generic
services:
- docker
env:
global:
- qemu_version=5.1.0-7
- target_version=0.37.0
- alpine_version=3.12
- target_platform=linux
matrix:
- target_arch=amd64 alpine_arch=linux/amd64 qemu_arch=x86_64 bin_arch=amd64
- target_arch=armv6 alpine_arch=linux/arm/v6 qemu_arch=arm bin_arch=arm
- target_arch=armv7 alpine_arch=linux/arm/v7 qemu_arch=arm bin_arch=arm
- target_arch=arm64 alpine_arch=linux/arm64/v8 qemu_arch=aarch64 bin_arch=arm64
before_install:
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- sudo apt-get update
- sudo apt-get -y install docker-ce
- mkdir $HOME/.docker
- 'echo "{" > $HOME/.docker/config.json'
- 'echo " \"experimental\": \"enabled\"" >> $HOME/.docker/config.json'
- 'echo "}" >> $HOME/.docker/config.json'
- sudo service docker restart
- mkdir bin
- docker run --rm --privileged multiarch/qemu-user-static:register
install:
- curl -sLO https://github.com/multiarch/qemu-user-static/releases/download/v${qemu_version}/qemu-${qemu_arch}-static.tar.gz;
- tar -xzvf qemu-${qemu_arch}-static.tar.gz;
- docker build --build-arg VERSION=v${target_version} --build-arg GOARCH=${bin_arch} --build-arg CONTAINER_ARCH=${alpine_arch} --build-arg ALPINE_VERSION=${alpine_version} --build-arg QEMU_ARCH=${qemu_arch} -t ndanyluk/cadvisor-${target_arch}:$TRAVIS_BUILD_NUMBER .
script:
- sudo docker run -d --name cadvisor ndanyluk/cadvisor-${target_arch}:$TRAVIS_BUILD_NUMBER
- sleep 5
- sudo docker ps | grep -q cadvisor
after_success:
- if [ -z "$DOCKER_USER" ]; then
echo "PR build, skipping Docker Hub push";
elif [ "$TRAVIS_BRANCH" != "master" ]; then
echo "Branch build, skipping Docker Hub push";
else
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS";
docker tag ndanyluk/cadvisor-${target_arch}:$TRAVIS_BUILD_NUMBER ndanyluk/cadvisor-${target_arch}:${target_version};
docker tag ndanyluk/cadvisor-${target_arch}:$TRAVIS_BUILD_NUMBER ndanyluk/cadvisor-${target_arch}:latest;
docker push ndanyluk/cadvisor-${target_arch}:${target_version};
docker push ndanyluk/cadvisor-${target_arch}:latest;
fi
jobs:
include:
- stage: deploy
install: skip
script: skip
after_success:
- if [ -z "$DOCKER_USER" ]; then
echo "PR build, skipping Docker Hub push";
elif [ "$TRAVIS_BRANCH" != "master" ]; then
echo "Branch build, skipping Docker Hub push";
else
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS";
docker manifest create ndanyluk/cadvisor:${target_version} ndanyluk/cadvisor-armv6:${target_version} ndanyluk/cadvisor-armv7:${target_version} ndanyluk/cadvisor-arm64:${target_version} ndanyluk/cadvisor-amd64:${target_version};
docker manifest create ndanyluk/cadvisor:latest ndanyluk/cadvisor-armv6:latest ndanyluk/cadvisor-armv7:latest ndanyluk/cadvisor-amd64:latest ndanyluk/cadvisor-arm64:latest;
docker manifest push ndanyluk/cadvisor:${target_version};
docker manifest push ndanyluk/cadvisor:latest;
fi