version: '3.8'

networks:
  dev:
    driver: bridge

services:
  mt-app:
    image: docker.io/library/hr
    depends_on:
      - "mt-db"
    container_name: mt-app-services
    ports:
      - "8080:80"
    build:
      context: .
      dockerfile: Dockerfile
    environment:
      - ConnectionStrings__MTWorkHRConnectionString=Server=mt-db;Database=MTWorkHRDB;User=sa;Password=p@ssw0rd;MultipleActiveResultSets=true;Integrated Security=True;Encrypt=False;
      - ASPNETCORE_URLS=http://+80
    networks:
      - dev
  mt-db:
    image: mcr.microsoft.com/mssql/server:2022-preview-ubuntu-22.04
    container_name: mt-db
    user: root
    environment:
      SA_USER: "sa"
      SA_PASSWORD: "p@ssw0rd"
      SA_DATABASE: "MTWorkHRDB"
      ACCEPT_EULA: "Y"
    ports:
      - "1433:1433"
    restart: always
    volumes:
      - app_data:/var/opt/mssql/data
    networks:
      - dev
volumes:
  app_data:
