services:
  nextcloud:
    image: nextcloud:apache
    container_name: nextcloud
    restart: unless-stopped
    volumes:
      - data:/var/www/html
    environment:
      POSTGRES_HOST: nextcloud-db
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: nextcloud
      POSTGRES_USER: nextcloud
      REDIS_HOST: nextcloud-redis
      TRUSTED_PROXIES: "172.23.0.0/24"
    depends_on:
      - db
      - redis

  db:
    image: postgres:16
    container_name: nextcloud-db
    restart: unless-stopped
    volumes:
      - data_db:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: nextcloud
      POSTGRES_USER: nextcloud

  redis:
    image: redis:alpine
    container_name: nextcloud-redis
    restart: unless-stopped
    volumes:
      - data_redis:/data

  office:
    image: collabora/code
    container_name: nextcloud-office
    restart: unless-stopped
    environment:
      DOMAIN: "cloud.timo.bmrs.nl"
      extra_params: "--o:ssl.enable=false --o:ssl.termination=true"


volumes:
  data:
  data_db:
  data_redis:

networks:
  default:
    name: proxy
    external: true
