version: '3.3'

services:
  redis:
    image: redis:alpine
    container_name: redis
    restart: unless-stopped
    command: redis-server --requirepass YOU_PASSWORD_REDIS
    volumes:
      - redis:/data
    networks:
      database: {}
  
  nextcloud:
    image: nextcloud:latest
    container_name: nextcloud
    restart: always
    hostname: nextcloud
    ports:
      - 88:80
    networks:
      database: {}
    volumes:
      - nextcloud:/var/www/html
    environment:
      - MYSQL_PASSWORD=YOU_PASSWORD_ROOT
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=root
      - MYSQL_HOST=db
      - REDIS_HOST=redis
      - REDIS_HOST_PASSWORD=YOU_PASSWORD_REDIS
      - PHP_MEMORY_LIMIT=2048M
      - PHP_UPLOAD_LIMIT=16G
      - TZ=Asia/Tokyo
    depends_on:
      - redis
      - onlyoffice
 
  onlyoffice:
    container_name: onlyoffice
    image: onlyoffice/documentserver:latest
    restart: always
    networks:
      database: {}
    volumes:
      - ./volumes/onlyoffice/data:/var/www/onlyoffice/Data:rw
      - ./volumes/onlyoffice/logs:/var/log/onlyoffice

volumes:
  nextcloud:
    name: nextcloud
  redis:
    name: redis
        
networks:
  database:
    external: true
    name: database