version: '3'

services:
  mongo:
    container_name: mongo
    image: mongo:4.2.1-bionic
    restart: always
    ports:
      - '27018:27017'
    networks:
      - backend
  app:
    container_name: ts-node-app
    build:
      context: .
      dockerfile: Dockerfile
      target: base
    restart: always
    env_file: .env
    expose:
      - ${PORT}
    ports:
      - ${PORT}:${PORT}
    environment:
      - MONGODB_URL=mongodb://mongo:27017/node-boilerplate
      - FRONTEND_URL=${FRONTEND_URL}
    links:
      - mongo
    depends_on:
      - mongo
    networks:
      - backend

networks:
  backend:
    driver: bridge
