version: '3.8'

services:
  for-real-consulting:
    image: git.arnemoerman.be/arne/for-real-consulting:latest
    container_name: for-real-consulting
    ports:
      - "8080:8080"
    environment:
      - ASPNETCORE_ENVIRONMENT=Production
      - ConnectionStrings__DefaultConnection=Server=mssql;User Id=sa;Password=${SA_PASSWORD};Initial Catalog=ForRealConsulting;Encrypt=false;TrustServerCertificate=true
    depends_on:
      - mssql
    networks:
      - for-real-consulting-network
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8080/"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s

  mssql:
    image: mcr.microsoft.com/mssql/server:2022-latest
    container_name: for-real-consulting-db
    environment:
      - ACCEPT_EULA=Y
      - SA_PASSWORD=${SA_PASSWORD}
      - MSSQL_PID=Developer
    ports:
      - "1433:1433"
    volumes:
      - mssql-data:/var/opt/mssql
    networks:
      - for-real-consulting-network
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "/opt/mssql-tools/bin/sqlcmd", "-S", "localhost", "-U", "sa", "-P", "${SA_PASSWORD}", "-Q", "SELECT 1"]
      interval: 10s
      timeout: 3s
      retries: 10
      start_period: 10s

networks:
  for-real-consulting-network:
    driver: bridge

volumes:
  mssql-data:
