version: "2"

services:
  postgres:
    image: "postgres:${POSTGRES_VERSION}"
    environment:
      - "POSTGRES_USER=postgres"
      - "POSTGRES_DB=goqupostgres"
    expose:
      - "5432"

  mysql:
    image: "mysql:${MYSQL_VERSION}"
    environment:
      - "MYSQL_DATABASE=goqumysql"
      - "MYSQL_ALLOW_EMPTY_PASSWORD=yes"
    expose:
      - "3306"

  goqu:
    image: "golang:${GO_VERSION}"
    command: bash -c "sleep 30 && go test -v -race ./..."
    working_dir: /go/src/github.com/doug-martin/goqu
    volumes:
      - "./:/go/src/github.com/doug-martin/goqu"
    environment:
      MYSQL_URI: 'root@tcp(mysql:3306)/goqumysql?parseTime=true'
      PG_URI: 'postgres://postgres:@postgres:5432/goqupostgres?sslmode=disable'
    depends_on:
      - postgres
      - mysql
  goqu-coverage:
    image: "golang:${GO_VERSION}"
    command: bash -c "sleep 30 && ./go.test.sh"
    working_dir: /go/src/github.com/doug-martin/goqu
    volumes:
      - "./:/go/src/github.com/doug-martin/goqu"
    environment:
      MYSQL_URI: 'root@tcp(mysql:3306)/goqumysql?parseTime=true'
      PG_URI: 'postgres://postgres:@postgres:5432/goqupostgres?sslmode=disable'
    depends_on:
      - postgres
      - mysql
