This repository has been archived by the owner on Feb 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 289
/
.travis.yml
42 lines (35 loc) · 1.52 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
language: bash
os: linux
services:
- docker
matrix:
include:
# amd64
- os: linux
arch: amd64
env:
- DOCKERFILE="Dockerfile"
- TAG_SUFFIX="latest"
- ALT_SUFFIX="amd64"
# arm32v5
- os: linux
arch: arm64
env:
- DOCKERFILE="Dockerfile.raspberry-pi"
- TAG_SUFFIX="arm32v5"
- ALT_SUFFIX="armhf"
script:
- export TARGET_IMAGE_TAG=$(if [ "$TRAVIS_BRANCH" = "master" ]; then if [ "$TAG_SUFFIX" = "" ]; then echo "latest"; else echo "$TAG_SUFFIX"; fi; else if [ "$TAG_SUFFIX" = "" ]; then echo "$TRAVIS_BRANCH"; else echo "$TRAVIS_BRANCH-$TAG_SUFFIX"; fi; fi)
- docker pull $TARGET_IMAGE:$TARGET_IMAGE_TAG && export IMAGE_CACHE="--cache-from $TARGET_IMAGE:$TARGET_IMAGE_TAG" || export IMAGE_CACHE=""
- docker build -f $DOCKERFILE $IMAGE_CACHE -t $TARGET_IMAGE:$TARGET_IMAGE_TAG .
- docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD
- docker push $TARGET_IMAGE:$TARGET_IMAGE_TAG
# push alternate tags
- if [ -z "$ALT_SUFFIX" ]; then
echo "No alternate tags set for this build.";
else
echo "Tagging with alternate tag '$ALT_SUFFIX'";
export ALT_IMAGE_TAG=$(if [ "$TRAVIS_BRANCH" = "master" ]; then if [ "$ALT_SUFFIX" = "" ]; then echo "error"; else echo "$ALT_SUFFIX"; fi; else if [ "$ALT_SUFFIX" = "" ]; then echo "$TRAVIS_BRANCH"; else echo "$TRAVIS_BRANCH-$ALT_SUFFIX"; fi; fi);
docker tag $TARGET_IMAGE:$TARGET_IMAGE_TAG $TARGET_IMAGE:$ALT_IMAGE_TAG;
docker push $TARGET_IMAGE:$ALT_IMAGE_TAG;
fi