services:
  backend:
    build: ./server
    container_name: bookingSys
    ports:
      - "3000:3000"
    depends_on:
      - db
    volumes:
      - ./public:/app/public
    environment:
      - PGUSER=aleks
      - PGPASSWORD=moni3niki
      - PGDATABASE=bookingsystem
      - PGHOST=db
      - PGPORT=5432
    networks:
      - booking_system_net

  db:
    image: postgres:15
    container_name: bookingsys_db
    restart: always
    environment:
      POSTGRES_USER: aleks
      POSTGRES_PASSWORD: moni3niki
      POSTGRES_DB: bookingsystem
    ports:
      - "5433:5432"
    volumes:
      - db_data:/var/lib/postgresql/data
      - ./init.sql:/docker-entrypoint-initdb.d/init.sql
    networks:
      - booking_system_net

volumes:
  db_data:

networks:
  booking_system_net:
    external: true
