version: '3.4'

services:
  db:
     container_name: workflowserver-mssql
     image: mcr.microsoft.com/mssql/server:2017-latest
     environment:
       SA_PASSWORD: MyStRoNgPWD12345678
       ACCEPT_EULA: Y
     volumes:
       - dbdata:/var/opt/mssql
     restart: always
     ports:
       - "1433:1433"
  start_db:
    container_name: workflowserver-mssql-wait
    image: mcr.microsoft.com/mssql-tools
    depends_on:
       - db
    volumes:
       - ./:/app/.docker
    entrypoint: /app/.docker/wait-for-mssql.sh workflowserver-mssql sa MyStRoNgPWD12345678 wfs
  workflowserver:
    container_name: workflowserver
    depends_on:
       - db
    build:
      context: ..
      dockerfile: ./WorkflowServer/Dockerfile
    ports:
       - "8077:8077"
       - "8078:8078"
    healthcheck:
      test: [ "CMD", "curl", "-f", "http://localhost:8077/liveness" ]
      interval: 30s
      timeout: 10s
      retries: 3
    volumes:
       - ./../logs:/app/wfs/logs
       - ./../license:/app/wfs/license
       - ./../metadata:/app/wfs/metadata
       - ./../InitialScripts:/app/wfs/InitialScripts
    environment:
      ConnectionString: Data Source=workflowserver-mssql;Initial Catalog=wfs;Integrated Security=False;User ID=sa;Password=MyStRoNgPWD12345678;TrustServerCertificate=True;
      Provider: mssql
      LicensePath: /app/wfs/license/
      MetadataFolder: /app/wfs/metadata/ 
      DefaultLoggerConfig__FileTarget__0: Information
      DefaultLoggerConfig__FileTarget__1: Error
      DefaultLoggerConfig__FileSettings__FileName: /app/wfs/logs/log.txt
      DefaultLoggerConfig__FileSettings__RollingInterval: Day
      DefaultLoggerConfig__FileSettings__RetainedFileCountLimit: 30
volumes:
    dbdata:
      name: wfs-mssql-data