version: '2'
services:
  api:
    container_name: doubtfire-api
    build: .
    command: bash -c "if [ -f /doubtfire-api/tmp/pids/server.pid ]; then rm /doubtfire-api/tmp/pids/server.pid; fi && rails server"
    ports:
      - "3000:3000"
    volumes:
      - ../doubtfire-api:/doubtfire-api
    links:
      - web
    depends_on:
      - db
    environment:
      DATABASE_URL: 'postgresql://itig:d872$$dh@db:5432/doubtfire_dev'

  db:
    container_name: doubtfire-db
    image: postgres
    ports:
      - "5432:5432"
    environment:
      POSTGRES_PASSWORD: d872$$dh
      POSTGRES_USER: itig

  web:
    container_name: doubtfire-web
    build: ../doubtfire-web
    command: npm start
    environment:
      DOUBTFIRE_DOCKER_MACHINE_IP: $DOUBTFIRE_DOCKER_MACHINE_IP
    ports:
      - "8000:8000"
      - "8080:8080"
    volumes:
      - ../doubtfire-web:/doubtfire-web

version: '2'
services:
  api:
    container_name: doubtfire-api
    build: .
    command: bash -c "if [ -f /doubtfire-api/tmp/pids/server.pid ]; then rm /doubtfire-api/tmp/pids/server.pid; fi && rails server"
    ports:
      - "3000:3000"
    volumes:
      - ../doubtfire-api:/doubtfire-api
    links:
      - web
    depends_on:
      - db
    environment:
      DATABASE_URL: 'postgresql://itig:d872$$dh@db:5432/doubtfire_dev'
      RAILS_ENV: 'development'

  db:
    container_name: doubtfire-db
    image: postgres
    ports:
      - "5432:5432"
    environment:
      POSTGRES_PASSWORD: d872$$dh
      POSTGRES_USER: itig

  web:
    container_name: doubtfire-web
    build: ../doubtfire-web
    command: npm start
    environment:
      DOUBTFIRE_DOCKER_MACHINE_IP: $DOUBTFIRE_DOCKER_MACHINE_IP
    ports:
      - "8000:8000"
      - "8080:8080"
    volumes:
      - ../doubtfire-web:/doubtfire-web

Add missing RAILS_ENV for docker api
FIX: Add missing RAILS_ENV for docker api

This is needed since when the rake db:populate command is run,
it will try and run for BOTH the test and development databases.
This is because since db:populate will run db:create, which by
default will try and create the test database also. Refer to
See http://jacopretorius.net/2014/02/all-rails-db-rake-tasks-
and-what-they-do.html

The test database still points to localhost, and since there is
no way to have multiple DATABASE_URL's for test and development,
this can only be overriden by having a static RAILS_ENV value.
