services:

  label-studio:
    stdin_open: true
    tty: true
    image: heartexlabs/label-studio:latest
    restart: unless-stopped
    user: root
    expose:
      - "8000"
    ports:
      - "30001:8000"
    depends_on:
      - pg-db
    environment:
      - DJANGO_DB=default
      - POSTGRE_NAME=postgres
      - POSTGRE_USER=postgres
      - POSTGRE_PASSWORD=
      - POSTGRE_PORT=5432
      - POSTGRE_HOST=db
      - LABEL_STUDIO_HOST=${LABEL_STUDIO_HOST:-}
      - LOCAL_FILES_SERVING_ENABLED=true
      - LOCAL_FILES_DOCUMENT_ROOT=/label-studio/local
      - USE_USERNAME_FOR_LOGIN=true
      - LABEL_STUDIO_USERNAME=admin@demo.com
      - LABEL_STUDIO_PASSWORD=demoadmin
      - LABEL_STUDIO_ENABLE_LEGACY_API_TOKEN=true
      - LABEL_STUDIO_USER_TOKEN=abc123abc123
      - LOG_LEVEL=DEBUG
    volumes:
      - label-studio-data:/label-studio/data:rw
      - dataset_volume:/label-studio/local:rw
    networks:
      - datamate
    command: label-studio-uwsgi

  pg-db:
    image: pgautoupgrade/pgautoupgrade:13-alpine
    hostname: db
    restart: unless-stopped
    environment:
      - POSTGRES_HOST_AUTH_METHOD=trust
      - POSTGRES_USER=postgres
    volumes:
      - label-studio-db:/var/lib/postgresql/data
    networks:
      - datamate

volumes:
  label-studio-data:
  label-studio-db:
  dataset_volume:
    name: datamate-dataset-volume
    external: true

networks:
  datamate:
    driver: bridge
    name: datamate-network
    external: true