-
Notifications
You must be signed in to change notification settings - Fork 21
/
.travis.yml
117 lines (94 loc) · 3.42 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
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
sudo: true
language: python
services:
- docker
env:
global:
- PROJECT=aqara-mqtt
- IMAGE_NAME=$DOCKER_USERNAME/$PROJECT
- VERSION=$(cat .semver)
- MAJOR=$(cut -d. -f1 .semver)
- MINOR=$(cut -d. -f2 .semver)
- PATCH=$(cut -d. -f3 .semver)
jobs:
include:
- stage: build x64 image
before_script:
- ARCH=x64
script:
# build
- docker build -t $PROJECT -f Dockerfile-$ARCH .
# push image
- >
if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
#1.0.0-arch
docker tag $PROJECT $IMAGE_NAME:$VERSION-$ARCH
docker push $IMAGE_NAME:$VERSION-$ARCH
#1.0-arch
docker tag $PROJECT $IMAGE_NAME:$MAJOR.$MINOR-$ARCH
docker push $IMAGE_NAME:$MAJOR.$MINOR-$ARCH
#1-arch
docker tag $PROJECT $IMAGE_NAME:$MAJOR-$ARCH
docker push $IMAGE_NAME:$MAJOR-$ARCH
#latest by arch
docker tag $PROJECT $IMAGE_NAME:$ARCH
docker push $IMAGE_NAME:$ARCH
fi
- stage: build i386 image
before_script:
- ARCH=i386
script:
# build
- docker build -t $PROJECT -f Dockerfile-$ARCH .
# push image
- >
if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
#1.0.0-arch
docker tag $PROJECT $IMAGE_NAME:$VERSION-$ARCH
docker push $IMAGE_NAME:$VERSION-$ARCH
#1.0-arch
docker tag $PROJECT $IMAGE_NAME:$MAJOR.$MINOR-$ARCH
docker push $IMAGE_NAME:$MAJOR.$MINOR-$ARCH
#1-arch
docker tag $PROJECT $IMAGE_NAME:$MAJOR-$ARCH
docker push $IMAGE_NAME:$MAJOR-$ARCH
#latest by arch
docker tag $PROJECT $IMAGE_NAME:$ARCH
docker push $IMAGE_NAME:$ARCH
fi
- stage: build armhf image
before_script:
- ARCH=armhf
script:
# prepare qemu
- docker run --rm --privileged multiarch/qemu-user-static:register --reset
# get qemu-arm-static binary
- >
mkdir tmp &&
pushd tmp &&
curl -L -o qemu-arm-static.tar.gz https://github.com/multiarch/qemu-user-static/releases/download/v2.6.0/qemu-arm-static.tar.gz &&
tar xzf qemu-arm-static.tar.gz &&
popd
#copy it to container
- sed -i -e '2iCOPY tmp/qemu-arm-static /usr/bin/qemu-arm-static\' Dockerfile-$ARCH
# build
- docker build -t $PROJECT -f Dockerfile-$ARCH .
# push image
- >
if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
#1.0.0-arch
docker tag $PROJECT $IMAGE_NAME:$VERSION-$ARCH
docker push $IMAGE_NAME:$VERSION-$ARCH
#1.0-arch
docker tag $PROJECT $IMAGE_NAME:$MAJOR.$MINOR-$ARCH
docker push $IMAGE_NAME:$MAJOR.$MINOR-$ARCH
#1-arch
docker tag $PROJECT $IMAGE_NAME:$MAJOR-$ARCH
docker push $IMAGE_NAME:$MAJOR-$ARCH
#latest by arch
docker tag $PROJECT $IMAGE_NAME:$ARCH
docker push $IMAGE_NAME:$ARCH
fi