sudo: required

services:
  - docker

dist: bionic

language: ruby
rvm:
  - 2.5.5

branches:
  only:
  - master

before_install:
  - docker pull mongo:3.6
  - docker pull redis
  - docker run -d -p 127.0.0.1:27017:27017 mongo:3.6
  - docker run -p 127.0.0.1:6379:6379 -d redis redis-server --appendonly yes
  - export DB_PORT=127.0.0.1:27017 SKIP_RABBIT_MQ=true
  - sudo apt install -y zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev libffi-dev imagemagick libmagickwand-dev

before_script:
  - bundle exec rake assets:precompile

script:
  - bundle exec rspec spec

after_success:
  #Log in to the Docker CLI
  - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin

  - docker build -t cenitgroup/cenitio:latest ./docker/cenit
  - docker push cenitgroup/cenitio:latest

  - docker build -t cenitgroup/cenitio:frontend ./docker/cenit_web
  - docker push cenitgroup/cenitio:frontend
  

sudo: required

services:
  - docker

dist: bionic

language: ruby
rvm:
  - 2.5.5

branches:
  only:
  - master
  - travis_configuration

before_install:
  #Log in to the Docker CLI
  - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
  - docker pull mongo:3.6
  - docker pull redis
  - docker run -d -p 127.0.0.1:27017:27017 mongo:3.6
  - docker run -p 127.0.0.1:6379:6379 -d redis redis-server --appendonly yes
  - export DB_PORT=127.0.0.1:27017 SKIP_RABBIT_MQ=true
  - sudo apt install -y zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev libffi-dev imagemagick libmagickwand-dev

before_script:
  - bundle exec rake assets:precompile

script:
  - bundle exec rspec spec

after_success:

  - docker build -t cenitgroup/cenitio:latest ./docker/cenit
  - docker push cenitgroup/cenitio:latest

  - docker build -t cenitgroup/cenitio:frontend ./docker/cenit_web
  - docker push cenitgroup/cenitio:frontend
  

Move docker login to begin of build
Move docker login to begin of build
