version: '3.8'

services:
  backend:
    build: ./backend
    image: ${REGISTRY}webrecorder/browsertrix-backend:${BACKEND_TAG:-latest}

    env_file:
      - ./configs/config.env

    depends_on:
      - minio
      - mongo

    environment:
      - CRAWLER_FQDN_SUFFIX=
      - JOB_IMAGE=${REGISTRY}webrecorder/browsertrix-backend:${BACKEND_TAG:-latest}

  frontend:
    build: ./frontend
    image: ${REGISTRY}webrecorder/browsertrix-frontend:${FRONTEND_TAG:-latest}
    ports:
      - 9871:80

    depends_on:
      - backend
      - minio

    environment:
      - BACKEND_HOST=backend
      - CRAWLER_FQDN_SUFFIX=
      - CRAWLER_SVC_SUFFIX=_crawler

  mongo:
    image: mongo
    volumes:
      - btrix-mongo-data:/data/db

    env_file:
      - ./configs/config.env


  minio:
    image: minio/minio
    #command: ["server", "/data", "--console-address", ":9001"]

    entrypoint: "/bin/sh"
    # auto-create bucket via existing dir (only for single-node mode)
    command: ["-c", "mkdir -p /data/$$MINIO_BUCKET; /usr/bin/docker-entrypoint.sh server /data --console-address :9001"]

    volumes:
      - ${MINIO_DATA_VOLUME:-btrix-minio-data}:/data

    env_file:
      - ./configs/config.env

    restart: always

volumes:
  btrix-redis-data:
  btrix-mongo-data:
  btrix-minio-data:

networks:
  default:
    name: btrix-net

