services:
  matrix-auth-service:
    image: ghcr.io/element-hq/matrix-authentication-service:latest
    container_name: matrix-auth-service
    environment:
      - MAS_CONFIG=/app/config/config.yaml
    ports:
      - "8088:8080" 
        #- "8083:8081" # health endpoint
    volumes:
      - ./config.yaml:/app/config/config.yaml:ro
      - ./policy.polar:/app/policy.polar
    depends_on:
      - db   
    restart: unless-stopped
    networks:
      - docker-network

  db:
    image: postgres:latest  
    container_name: mas-db
      #ports: 
      #- "5432:5432" # Only needed for the initial migration step later
    environment:
      POSTGRES_USER: mas_user
      POSTGRES_PASSWORD: mas_password  # Set a secure password
      POSTGRES_DB: mas
    volumes:
      - ./db_data:/var/lib/postgresql/data
    restart: unless-stopped
    networks:
      - docker-network

networks:
  docker-network:
    external: true
