Portainer Stack:
```yaml
---
version: "3.9"
services:
  nextcloud:
    image: lscr.io/linuxserver/nextcloud:${TAG-latest}
    container_name: nextcloud
    environment:
      - PUID=${PUID-1000}
      - PGID=${PGID-1000}
      - TZ=${TZ-Europe/Amsterdam}
      - NEXTCLOUD_UPDATE=1
      - DOCKER_MODS=linuxserver/mods:nextcloud-mediadc
    network_mode: ${NET-bridge}
    volumes:
      - ${FOLDERS}/nextcloud/config:/config
      - ${FOLDERS}/nextcloud/data:/data
#    ports:
#      - 52443:443
    restart: ${RST-unless-stopped}
    labels:
      - com.centurylinklabs.watchtower.enable=${AutoUpdate-true}

  nextcloud_db:
    image: lscr.io/linuxserver/mariadb:${TAG-latest}
    container_name: nextcloud_db
    network_mode: ${NET-bridge}
    environment:
      - PUID=${PUID-1000}
      - PGID=${PGID-1000}
      - TZ=${TZ-Europe/Amsterdam}
      - MYSQL_ROOT_PASSWORD=${db_rootpwd}
      - MYSQL_DATABASE=${db_name}
      - MYSQL_USER=${db_user}
      - MYSQL_PASSWORD=${db_password}
    volumes:
      - ${FOLDERS}/nextcloud/db:/config
    restart: ${RST-unless-stopped}
    labels:
      - com.centurylinklabs.watchtower.enable=${AutoUpdate-true}
      - db=mariadb

```

Environments:
```
TAG=latest
RST=unless-stopped
NET=bridge
PUID=1000
PGID=1000
TZ=${TZ-Europe/Amsterdam}
AutoUpdate=true
FOLDERS=
```


To install Face Detection App, search for the folder `custom-cont-init.d` and create a file eg: `install_custom_php7-dlib.sh` and paste:

```bash
#!/bin/bash
#FLAG="/config/firstbook.log"
FLAG="/usr/lib/php7/modules/pdlib.so"
if [ ! -f $FLAG ]; then
  apk add --no-cache --upgrade make cmake gcc g++ php7-dev libx11-dev openblas-dev re2c

  rm -rf dlib pdlib
  git clone https://github.com/davisking/dlib.git
  cd dlib/dlib
  mkdir build
  cd build
  cmake -DBUILD_SHARED_LIBS=ON ..
  make
  sudo make install

  cd /

  git clone https://github.com/goodspb/pdlib.git
  cd pdlib
  phpize
  PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig ./configure
  make
  sudo make install
  rm -rf /dlib /pdlib
#  touch $FLAG
else
  echo "Already run of 1st boot. Delete /config/firstboot.log to run again on next boot"
fi
```

And restart the container:
```
docker restart nextcloud
```

If Face Detection still cannot be installed ssh into the container and remove `/usr/lib/php7/modules/pdlib.so`

[Sauce](https://github.com/linuxserver/docker-nextcloud/issues/171)