Hi all,
After tinkering around for 7 days to make my nextcloud instance working with Face Recognition and Memories, finally I make it, just want to share my configuration here
It is newest nextcloud (nextcloud 16) and I’m using docker with pdlib and hardware acceleration working. (i5 7600 without any vga card)
Docker compose
version: '3'
services:
nextcloud:
build:
context: ./volumes/nextcloud
dockerfile: Dockerfile
container_name: nextcloud
ports:
- 8080:80
volumes:
- ./volumes/nextcloud/data:/var/www/html/data:rw
- ./volumes/nextcloud/app:/var/www/html
- ./volumes/nextcloud/nextcloud.ini:/usr/local/etc/php/conf.d/nextcloud.ini # to make config easier
- ./volumes/nextcloud/start.sh:/start.sh # for permission on hardware acceleration, ONLY RUN ONCE
- /dev/dri:/dev/dri # intel/AMD driver
restart: unless-stopped
Dockerfile
FROM nextcloud:26-apache
RUN apt-get update \
&& apt-get install -y \
cmake \
ffmpeg \
ghostscript \
git \
imagemagick \
libbz2-dev \
liblapack-dev \
libopenblas-dev \
libx11-dev \
sudo \
nano \
&& apt-get clean
RUN apt-get update && \
apt-get install -y software-properties-common && \
apt-add-repository -y non-free && \
apt-get update && \
apt-get install -y intel-media-va-driver-non-free ffmpeg
RUN git clone https://github.com/davisking/dlib.git \
&& cd dlib/dlib \
&& mkdir build \
&& cd build \
&& cmake -DBUILD_SHARED_LIBS=ON .. \
&& make \
&& make install
RUN git clone https://github.com/goodspb/pdlib.git /usr/src/php/ext/pdlib
RUN docker-php-ext-install pdlib
RUN docker-php-ext-install bz2
RUN echo '12 * * * * php /var/www/html/occ face:background_job' >> /var/spool/cron/crontabs/www-data
RUN echo '37 * * * * php /var/www/html/occ preview:pre-generate' >> /var/spool/cron/crontabs/www-data
nextcloud.ini (create first before building)
memory_limit = 10G
upload_max_filesize= 10G
post_max_size = 10G
max_execution_time = 3600
max_input_time = 3600
start.sh - run this manually after complete building
#!/bin/bash
GID=`stat -c "%g" /dev/dri/renderD128`
GROUP=$(getent group $GID | cut -d: -f1)
if [ -z "$GROUP" ]; then
groupadd -g $GID render
usermod -aG render www-data
fi
then
docker-compose up -d --build
Install your nextcloud first, and add Face recognition apps and Memories (optional)
for post installation, go inside the container
docker exec -it nextcloud bash
Run the start.sh
/bin/sh /start.sh
configure Face Recoginition memory
sudo -u www-data php occ face:setup --memory 10GB
add/update your nextcloud config/config.php inside the array
'memories.exiftool' => '/var/www/html/custom_apps/memories/exiftool-bin/exiftool-amd64-glibc',
'memories.vod.path' => '/var/www/html/custom_apps/memories/exiftool-bin/go-vod-amd64',
'memories.vod.ffmpeg' => '/usr/bin/ffmpeg',
'memories.vod.ffprobe' => '/usr/bin/ffprobe',
'memories.vod.bind' => '127.0.0.1:47788',
'memories.vod.connect' => '127.0.0.1:47788',
'memories.exiftool_no_local' => true,
'memories.vod.disable' => false,
'memories.vod.vaapi' => true,
'memories.vod.vaapi.low_power' => true,
to verify if you have qsv (QuickSync Video), run this command, and verify if you have h.264_qsv, h.265_qsv, etc working
ffmpeg -decoders | grep qsv
ffmpeg -encoders | grep qsv
And then restart your container
docker-compose restart nextcloud
I hope this helps everyone who wants to create their own nextcloud with face recognition.
PS: I’m not docker expert