forked from kalisio/crisis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.app.sh
67 lines (49 loc) · 1.6 KB
/
.travis.app.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
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
#!/bin/bash
push_docker () {
docker push kalisio/$1:$2
check_code $? "Pushing the $2 $1 docker image"
docker tag kalisio/$1:$2 kalisio/$1:$3
docker push kalisio/$1:$3
check_code $? "Pushing the $3 $1 docker image"
}
#
# Provision the required files
#
travis_fold start "provision"
source .travis.env.sh
docker login -u="$DOCKER_USER" -p="$DOCKER_PASSWORD"
check_code $? "Connecting to Docker"
travis_fold end "provision"
#
# Build the app
#
travis_fold start "build"
# Build the api
cd api && yarn build
check_code $? "Building the api"
# Build the client
cd .. && yarn build
BUILD_CODE=$?
tail -n 24 build.log
check_code $BUILD_CODE "Builing the client"
# Create an archive to speed docker build process
cd ../..
tar -zcf kalisio.tgz kalisio
docker build --build-arg APP=$APP --build-arg FLAVOR=$FLAVOR --build-arg BUILD_NUMBER=$BUILD_NUMBER -f dockerfile -t kalisio/$APP:$TAG .
check_code $? "Building the app docker image"
docker build --build-arg APP=$APP --build-arg TAG=$TAG -f dockerfile.api-tester -t kalisio/$APP:${TAG}_api-tester .
check_code $? "Building the tests api docker image"
docker build --build-arg APP=$APP -f dockerfile.client-tester -t kalisio/$APP:${TAG}_client-tester .
check_code $? "Building the tests client docker image"
travis_fold end "build"
#
# Deploy the app
#
travis_fold start "deploy"
# Push the app image to the hub
push_docker $APP $TAG $FLAVOR
# Push the tests api image to the hub
push_docker $APP ${TAG}_api-tester ${FLAVOR}_api-tester
# Push the tests client image to the hub
push_docker $APP ${TAG}_client-tester ${FLAVOR}_client-tester
travis_fold end "deploy"