forked from HSLdevcom/pelias-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
travis-build.sh
executable file
·38 lines (31 loc) · 959 Bytes
/
travis-build.sh
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
#!/bin/bash
# Set these environment variables
#DOCKER_USER=
#DOCKER_AUTH=
set -e
ORG=${ORG:-hsldevcom}
DOCKER_TAG=${TRAVIS_COMMIT:-latest}
DOCKER_IMAGE=$ORG/pelias-api
DOCKER_IMAGE_COMMIT=$DOCKER_IMAGE:$DOCKER_TAG
DOCKER_IMAGE_LATEST=$DOCKER_IMAGE:latest
DOCKER_IMAGE_PROD=$DOCKER_IMAGE:prod
if [ -z $TRAVIS_TAG ]; then
# Build image
echo "Building pelias-api"
docker build --tag="$DOCKER_IMAGE_COMMIT" .
fi
if [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then
docker login -u $DOCKER_USER -p $DOCKER_AUTH
if [ "$TRAVIS_TAG" ];then
echo "processing release $TRAVIS_TAG"
docker pull $DOCKER_IMAGE_COMMIT
docker tag $DOCKER_IMAGE_COMMIT $DOCKER_IMAGE_PROD
docker push $DOCKER_IMAGE_PROD
else
echo "Pushing latest image"
docker push $DOCKER_IMAGE_COMMIT
docker tag $DOCKER_IMAGE_COMMIT $DOCKER_IMAGE_LATEST
docker push $DOCKER_IMAGE_LATEST
fi
fi
echo Build completed