version: "3.9"

volumes:
  postgres-server-volume:
services:

  postgres:
    image: postgres:12.9
    container_name: postgresServ
    ports:
      - 5433:5432
    volumes:
      - postgres-server-volume:/var/lib/postgresql/data
    networks:
      - sigsmartcampus2-network
    environment:
      POSTGRES_DB: postgres
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres

  registry:
    container_name: registry-server
    build:
      context: ./discovery
      dockerfile: ./Dockerfile
    ports:
      - 8081:8081
    networks:
      - sigsmartcampus2-network

  gateway:
    container_name: gateway-server
    build:
      context: ./gateway
      dockerfile: ./Dockerfile
    ports:
      - 8080:8080
    depends_on:
      - registry
    networks:
      - sigsmartcampus2-network

  withdrawal:
    container_name: withdrawal-server
    build:
      context: withdrawal
      dockerfile: ./Dockerfile
    ports:
      - 8083:8083
    networks:
      - sigsmartcampus2-network
    depends_on:
      - postgres
      - gateway

  balance:
    container_name: balance-server
    build:
      context: balance
      dockerfile: ./Dockerfile
    ports:
      - 8084:8084
    networks:
      - sigsmartcampus2-network
    depends_on:
      - postgres
      - gateway

networks:
  sigsmartcampus2-network:
    driver: bridge
