-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path.travis.yml
111 lines (84 loc) · 3.95 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
---
sudo: required
dist: trusty
services:
- docker
env:
- VERSION=2.6
- VERSION=2.5
- VERSION=2.4
- VERSION=2.3
before_install:
- sudo apt-get install -y curl
before_script:
- env | sort
# - cd "$VERSION"
# - slash='/'; image="ruby:${VERSION}-${VARIANT//$slash/-}"
script:
# Build docker image
# - cd 2.3/
- docker build -t maestrano/web-ruby:travis -f ${VERSION}/Dockerfile .
#=======================================
# Test with minimal parameters
#=======================================
# Run image
- docker run -P -d --name travis-test -e GIT_URL=https://github.com/maestrano/sample_app_rails_4 -e GIT_BRANCH=master maestrano/web-ruby:travis
# Get ip address
- "container_ip=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' travis-test`"
# Wait for container to be ready
- try_count=0;
- HEALTH_CHECK="starting"
- while [ "$HEALTH_CHECK" == "starting" ] || [ "$HEALTH_CHECK" == "unhealthy" ]; do let "try_count++"; [ $try_count -gt 100 ] && exit 20; sleep 5; HEALTH_CHECK=$(docker inspect --format='{{.State.Health.Status}}' travis-test 2>/dev/null); done
# Check that application is up
- "curl http://${container_ip}:80/"
# Remove container
- docker rm -f travis-test
#=======================================
# Test with S3
#=======================================
# Run image
- docker run -P -d --name travis-test -e S3_URI=s3://cdn-prd-maestrano/pkg/sample/sample_app_rails.tar.gz -e S3_REGION=ap-southeast-1 maestrano/web-ruby:travis
# Get ip address
- "container_ip=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' travis-test`"
# Wait for container to be ready
- try_count=0;
- HEALTH_CHECK="starting"
- while [ "$HEALTH_CHECK" == "starting" ] || [ "$HEALTH_CHECK" == "unhealthy" ]; do let "try_count++"; [ $try_count -gt 100 ] && exit 20; sleep 5; HEALTH_CHECK=$(docker inspect --format='{{.State.Health.Status}}' travis-test 2>/dev/null); done
# Check that application is up
- "curl http://${container_ip}:80/"
# Remove container
- docker rm -f travis-test
#=======================================
# Test with foreman options
#=======================================
# Run image
- docker run -P -d --name travis-test -e FOREMAN_OPTS="-m web=1" -e GIT_URL=https://github.com/maestrano/sample_app_rails_4 -e GIT_BRANCH=master maestrano/web-ruby:travis
# Get ip address
- "container_ip=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' travis-test`"
# Wait for container to be ready
- try_count=0;
- HEALTH_CHECK="starting"
- while [ "$HEALTH_CHECK" == "starting" ] || [ "$HEALTH_CHECK" == "unhealthy" ]; do let "try_count++"; [ $try_count -gt 100 ] && exit 20; sleep 5; HEALTH_CHECK=$(docker inspect --format='{{.State.Health.Status}}' travis-test 2>/dev/null); done
# Check that application is up
- "curl http://${container_ip}:80/"
# Remove container
- docker rm -f travis-test
#=======================================
# Test with Gemstash server
#=======================================
# Run gemstash server
- docker run -P -d --name gemstash maestrano/gemstash
# Get gemstash ip address
- "gemstash_ip=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' gemstash`"
# Run image
- docker run -P -d --name travis-test -e GEMSTASH_SERVER="http://${gemstash_ip}:9292" -e GIT_URL=https://github.com/maestrano/sample_app_rails_4 -e GIT_BRANCH=master maestrano/web-ruby:travis
# Get ip address
- "container_ip=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' travis-test`"
# Wait for container to be ready
- try_count=0;
- HEALTH_CHECK="starting"
- while [ "$HEALTH_CHECK" == "starting" ] || [ "$HEALTH_CHECK" == "unhealthy" ]; do let "try_count++"; [ $try_count -gt 100 ] && exit 20; sleep 5; HEALTH_CHECK=$(docker inspect --format='{{.State.Health.Status}}' travis-test 2>/dev/null); done
# Check that application is up
- "curl http://${container_ip}:80/"
# Remove container
- docker rm -f travis-test