version: "3.4"

services:
  db:
    image: postgres:9.6-alpine
    restart: always
    environment:
      - POSTGRES_USER=jira-clone
      - POSTGRES_PASSWORD=jira-clone
      - POSTGRES_DB=jira-clone
    networks:
      - default
    volumes:
      - ./persist/db/git:/var/lib/postgresql/data

  api:
    build: .
    restart: always
    environment:
      - NODE_ENV=development
      - DB_HOST=db
      - DB_PORT=5432
      - DB_USERNAME=jira-clone
      - DB_PASSWORD=jira-clone
      - DB_DATABASE=jira-clone
      ## Please change this string to something unique.
      - JWT_SECRET=development12345
    command: ["api"]
    depends_on:
      - db
    networks:
      - default

  client:
    build: .
    restart: always
    environment:
    ports:
      - 8080:8080
    networks:
      - default
    environment:
      - RUN_MODE=api
      - NODE_ENV=development
      - DB_HOST=localhost
      - DB_PORT=5432
      - DB_USERNAME=jira-clone
      - DB_PASSWORD=jira-clone
      - DB_DATABASE=jira-clone
      ## Please change this string to something unique.
      - JWT_SECRET=development12345
    depends_on:
      - api
    command: ["client"]

networks:
  default:
