services:
  onlyoffice-documentserver:
    build:
      context: .
    container_name: onlyoffice-documentserver
    depends_on:
      - onlyoffice-rabbitmq
    environment:
      - DB_TYPE=${ONLYOFFICE_DB_TYPE}
      - DB_HOST=${ONLYOFFICE_DB_HOST}
      - DB_PORT=${ONLYOFFICE_DB_PORT}
      - DB_NAME=${ONLYOFFICE_DB_NAME}
      - DB_USER=${ONLYOFFICE_DB_USER}
      - DB_PWD=${ONLYOFFICE_DB_PASSWORD}
      - AMQP_URI=amqp://guest:guest@onlyoffice-rabbitmq
      # Uncomment strings below to enable the JSON Web Token validation.
      - JWT_ENABLED=true
      - JWT_SECRET=${ONLYOFFICE_JWT_SECRET}
      - JWT_HEADER=Authorization
      - JWT_IN_BODY=true
    stdin_open: true
    stop_grace_period: 60s
    volumes:
      - ./app/data:/var/www/onlyoffice/Data
      - ./app/log:/var/log/onlyoffice
      - ./app/cache:/var/lib/onlyoffice/documentserver/App_Data/cache/files
      - ./app/files:/var/www/onlyoffice/documentserver-example/public/files
      - ./app/fonts:/usr/share/fonts
    networks:
      - database
      - nextcloud
      - onlyoffice
    restart: unless-stopped

  onlyoffice-rabbitmq:
    container_name: onlyoffice-rabbitmq
    image: rabbitmq
    restart: unless-stopped
    expose:
      - '5672'
    networks:
      - onlyoffice

networks:
  database:
    external: true
  nextcloud:
    external: true
  onlyoffice:
    name: onlyoffice
