pipeline:
  test:
    image: presslabs/silver
    pull: true
    environment:
      - SILVER_DB_ENGINE=django.db.backends.mysql
      - SILVER_DB_NAME=test_db
      - SILVER_DB_HOST=127.0.0.1
      - SILVER_DB_USER=silver
      - SILVER_DB_PASSWORD=silver
    commands:
      - make dependencies
      - mkdir /var/log/silver
      - make lint
      - make test

  publish-docker-master:
    image: plugins/docker
    repo: presslabs/silver
    tag: $${BRANCH/master/latest}
    secrets:
      - DOCKER_USERNAME
      - DOCKER_PASSWORD
    when:
      event: push
      branch: master

  publish-docker-tag:
    image: plugins/docker
    repo: presslabs/silver
    tag: "$${TAG##v}"
    secrets:
      - DOCKER_USERNAME
      - DOCKER_PASSWORD
    when:
      event: tag

services:
  mysql:
    image: mysql:5.5
    environment:
      - MYSQL_DATABASE=test_db
      - MYSQL_ROOT_PASSWORD=secret
      - MYSQL_USER=silver
      - MYSQL_PASSWORD=silver
  redis:
    image: redis:3-alpine

pipeline:
  test:
    image: presslabs/silver
    pull: true
    environment:
      - SILVER_DB_ENGINE=django.db.backends.mysql
      - SILVER_DB_NAME=test_db
      - SILVER_DB_HOST=mysql
      - SILVER_DB_USER=silver
      - SILVER_DB_PASSWORD=silver
    commands:
      - make dependencies
      - mkdir /var/log/silver
      - make lint
      - make test

  publish-docker-master:
    image: plugins/docker
    repo: presslabs/silver
    tag: $${BRANCH/master/latest}
    secrets:
      - DOCKER_USERNAME
      - DOCKER_PASSWORD
    when:
      event: push
      branch: master

  publish-docker-tag:
    image: plugins/docker
    repo: presslabs/silver
    tag: "$${TAG##v}"
    secrets:
      - DOCKER_USERNAME
      - DOCKER_PASSWORD
    # when:
    #   event: tag

services:
  mysql:
    image: mysql:5.5
    environment:
      - MYSQL_DATABASE=test_db
      - MYSQL_ROOT_PASSWORD=secret
      - MYSQL_USER=silver
      - MYSQL_PASSWORD=silver
  redis:
    image: redis:3-alpine

Use mysql host instead of 127.0.0.1
Use mysql host instead of 127.0.0.1
