version: '3.0' # specify docker-compose version

# Define the services/ containers to be run
services:
  backend-test: # name of the second service
    build: 
      context: ../ # specify the directory of the Dockerfile
      dockerfile: docker/Dockerfile-tests-watch
    volumes: 
      - ../api:/usr/src/app/api
    depends_on:
      - postgresdb
    container_name: backend-test
    env_file:
      - .env.test
    ports:
      - "4000:4000" #specify ports mapping
    environment:
      - NODE_ENV=test ## Set Env Variable for testing  
      - BLOCKCHAIN_ENV=test ## Set Env Variable for testing  
      - POSTGRES_URI=postgresdb:5432
    links:
      - postgresdb
    tty: true
  
  postgresdb: # name of the third service
    image: postgres:10.4 # specify image to build container from
    ports:
      - "5432:5432" # specify port forwarding
    env_file:
       - .env.test
