-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy path.travis.yml
32 lines (27 loc) · 1.23 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
sudo: required
language: ruby
services:
- docker
install:
- docker run -d --name redis redis:3.2.8
- docker run -d --name postgres postgres:9.6.2
- cp Dockerfile.production Dockerfile
- docker build -t zedtux/brewformulas.org:latest .
script:
- cp Dockerfile.ci Dockerfile
- docker images
- docker build -t zedtux/brewformulas.org:ci .
- docker run --link redis:redis --link postgres:database -it zedtux/brewformulas.org:ci bundle exec rake db:create db:setup RAILS_ENV=test
- docker run --link redis:redis --link postgres:database -it zedtux/brewformulas.org:ci bundle exec rake
after_success:
- "docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS"
- export DOCKER_TAG=`if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi`
- export DOCKER_TAG=`echo $DOCKER_TAG | sed -e 's/\//-/g'`
- echo "Tagging the docker image with $DOCKER_TAG ..."
- "docker tag zedtux/brewformulas.org:latest zedtux/brewformulas.org:$DOCKER_TAG"
- docker rm `docker ps --no-trunc -aq`
- "docker push zedtux/brewformulas.org:$DOCKER_TAG"
- "docker rmi zedtux/brewformulas.org:$DOCKER_TAG"
- "docker rmi zedtux/brewformulas.org:ci"
- "docker rmi zedtux/brewformulas.org:latest"
- docker logout