services:
  sql:
    image: mcr.microsoft.com/mssql/server:2022-latest
    container_name: sql
    environment:
      - ACCEPT_EULA=Y
      - SA_PASSWORD=Ou812@12!@
    ports:
      - "1433:1433"
  backend:
    build:
      context: ./backend
      dockerfile: Dockerfile
    depends_on:
      - sql
    container_name: backend
    environment:
      - DB_SERVER=sql
      - DB_USER=sa
      - DB_PASSWORD=Ou812@12!@
      - DB_NAME=CustomerDB
    ports:
      - "8080:8080"
    command: ./main
    extra_hosts:
      - "homelab.local:192.168.1.129"

  init-db:
    build:
      context: ./db
      dockerfile: Dockerfile
    container_name: init-db
    depends_on:
      - sql
    environment:
      - DB_SERVER=sql
      - DB_USER=sa
      - DB_PASSWORD=Ou812@12!@
      - DB_NAME=CustomerDB
