version: '3.8'

services:
  db:
    image: mariadb:10.5
    container_name: nextcloud-db
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=rootpass
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextclouduser
      - MYSQL_PASSWORD=nextcloudpass
    volumes:
      - ./db:/var/lib/mysql

  app:
    image: nextcloud:28
    container_name: nextcloud
    restart: always
    ports:
      - "8888:80"
    links:
      - db
    environment:
      - MYSQL_PASSWORD=nextcloudpass
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextclouduser
      - MYSQL_HOST=db
    volumes:
      - ./nextcloud:/var/www/html
