Open agboom opened 4 years ago
Possibly related to: https://stackoverflow.com/questions/36710514/linking-with-rcpparmadillo-lapack-fails-undefined-symbol-dgesdd/36732773#36732773
Need to include that extra lib LAPACK?
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
Hmm, these build logs do report that the lapack package is not found, so that might be a possible cause. However, the Dlib docs imply that lapack is optional:
Dlib is also capable of using any optimized BLAS or LAPACK libraries that are installed on your system. Linking to these libraries will make many things run faster.
I'll try to build the package with lapack included to see if it makes a difference.
Edit: sorry, forgot to include link to the build logs: https://build.alpinelinux.org/buildlogs/build-edge-x86_64/testing/dlib/dlib-19.18-r0.log
For reference, here's a Dockerfile that I mashed up based on earlier comments by @matiasdelellis and some tweaking by me. The pdlib tests seem to run fine, even with lapack not installed :thinking:
FROM alpine AS builder
# DLib https://github.com/goodspb/pdlib#dependencies
RUN apk add cmake make gcc libc-dev g++ unzip openblas-dev libx11-dev pkgconf jpeg jpeg-dev libpng libpng-dev
ARG DLIB_BRANCH=v19.19
RUN wget -c -q https://github.com/davisking/dlib/archive/${DLIB_BRANCH}.tar.gz \
&& tar xf ${DLIB_BRANCH}.tar.gz \
&& mv dlib-* dlib \
&& cd dlib/dlib \
&& mkdir build \
&& cd build \
&& cmake -DBUILD_SHARED_LIBS=ON --config Release .. \
&& make \
&& make install
# https://github.com/goodspb/pdlib#installation
RUN apk add php7-dev php7-gd
ENV PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib64/pkgconfig/
RUN pkg-config --libs --cflags libjpeg \
&& pkg-config --libs --cflags dlib-1
ARG PDLIB_BRANCH=master
RUN wget -c -q https://github.com/goodspb/pdlib/archive/$PDLIB_BRANCH.zip \
&& unzip $PDLIB_BRANCH \
&& mv pdlib-* pdlib \
&& cd pdlib \
&& phpize \
&& ./configure \
&& make \
&& make install
RUN echo "extension=pdlib.so" > /etc/php7/conf.d/pdlib.ini
# Download test and clean it
RUN wget https://github.com/matiasdelellis/facerecognition/files/3107912/crop-tests.zip \
; unzip -q crop-tests.zip \
; rm crop-tests/cropped_* \
; rm crop-tests/test.csv
# download models needed to test and execute it..
RUN cd crop-tests ; mkdir -p vendor/models/1/ \
; wget https://github.com/davisking/dlib-models/raw/94cdb1e40b1c29c0bfcaf7355614bfe6da19460e/mmod_human_face_detector.dat.bz2 -O vendor/models/1/mmod_human_face_detector.dat.bz2 \
; bzip2 -d vendor/models/1/mmod_human_face_detector.dat.bz2 \
; wget https://github.com/davisking/dlib-models/raw/2a61575dd45d818271c085ff8cd747613a48f20d/dlib_face_recognition_resnet_model_v1.dat.bz2 -O vendor/models/1/dlib_face_recognition_resnet_model_v1.dat.bz2 \
; bzip2 -d vendor/models/1/dlib_face_recognition_resnet_model_v1.dat.bz2 \
; wget https://github.com/davisking/dlib-models/raw/4af9b776281dd7d6e2e30d4a2d40458b1e254e40/shape_predictor_5_face_landmarks.dat.bz2 -O vendor/models/1/shape_predictor_5_face_landmarks.dat.bz2 \
; bzip2 -d vendor/models/1/shape_predictor_5_face_landmarks.dat.bz2 \
; php test.php
Being a docker newbie I just added your code above to my exising Dockerfile - and ran the ansible playbook for the project. The "testing" lines leads errors in my setup:
u' ---> Running in dde5d152ae0d\\n',
u'Removing intermediate container dde5d152ae0d\\n',
u' ---> a72b8ab9a511\\n',
u'Step 13/16 : RUN wget https://github.com/matiasdelellis/facerecognition/files/3107912/crop-tests.zip ; unzip -q crop-tests.zip ; rm crop-tests/cropped_* ; rm crop-tests/test.csv',
u'\\n',
u' ---> Running in 22fd9d910b45\\n',
u'\\x1b[91mConnecting to github.com (140.82.118.4:443)\\n\\x1b[0m',
u'\\x1b[91mConnecting to github-production-repository-file-5c1aeb.s3.amazonaws.com (52.216.238.235:443)\\n\\x1b[0m',
u\"\\x1b[91msaving to 'crop-tests.zip'\\n\\x1b[0m\",
u'\\x1b[91mcrop-tests.zip 4% |* | 406k 0:00:23 ETA\\n\\x1b[0m',
u'\\x1b[91mcrop-tests.zip 14% |**** | 1477k 0:00:11 ETA\\n\\x1b[0m',
u'\\x1b[91mcrop-tests.zip 27% |******** | 2702k 0:00:08 ETA\\n\\x1b[0m',
u'\\x1b[91mcrop-tests.zip 40% |************* | 4045k 0:00:05 ETA\\n\\x1b[0m',
u'\\x1b[91mcrop-tests.zip 55% |***************** | 5507k 0:00:04 ETA\\n\\x1b[0m',
u'\\x1b[91mcrop-tests.zip 68% |********************** | 6867k 0:00:02 ETA\\n\\x1b[0m',
u'\\x1b[91mcrop-tests.zip 82% |************************** | 8227k 0:00:01 ETA\\n\\x1b[0m',
u'\\x1b[91mcrop-tests.zip 97% |******************************* | 9655k 0:00:00 ETA\\n\\x1b[0m',
u\"\\x1b[91mcrop-tests.zip 100% |********************************| 9954k 0:00:00 ETA\\n'crop-tests.zip' saved\\n\\x1b[0m\",
u'Removing intermediate container 22fd9d910b45\\n',
u' ---> 76df72789d4f\\n',
u'Step 14/16 : RUN cd crop-tests ; mkdir -p vendor/models/1/ ; wget https://github.com/davisking/dlib-models/raw/94cdb1e40b1c29c0bfcaf7355614bfe6da19460e/mmod_human_face_detector.dat.bz2 -O vendor/models/1/mmod_human_face_detector.dat.bz2 ; bzip2 -d vendor/models/1/mmod_human_face_detector.dat.bz2 ; wget https://github.com/davisking/dlib-models/raw/2a61575dd45d818271c085ff8cd747613a48f20d/dlib_face_recognition_resnet_model_v1.dat.bz2 -O vendor/models/1/dlib_face_recognition_resnet_model_v1.dat.bz2 ; bzip2 -d vendor/models/1/dlib_face_recognition_resnet_model_v1.dat.bz2 ; wget https://github.com/davisking/dlib-models/raw/4af9b776281dd7d6e2e30d4a2d40458b1e254e40/shape_predictor_5_face_landmarks.dat.bz2 -O vendor/models/1/shape_predictor_5_face_landmarks.dat.bz2 ; bzip2 -d vendor/models/1/shape_predictor_5_face_landmarks.dat.bz2 ; php test.php',
u'\\n',
u' ---> Running in 3bbc86385b7c\\n',
u\"\\x1b[91m/bin/sh: cd: line 1: can't cd to crop-tests: No such file or directory\\n\\x1b[0m\",
u'\\x1b[91mConnecting to github.com (140.82.118.4:443)\\n\\x1b[0m',
u'\\x1b[91mConnecting to raw.githubusercontent.com (151.101.112.133:443)\\n\\x1b[0m',
u\"\\x1b[91msaving to 'vendor/models/1/mmod_human_face_detector.dat.bz2'\\n\\x1b[0m\",
u'\\x1b[91mmmod_human_face_dete \\x1b[0m',
u'\\x1b[91m100% \\x1b[0m',
u'\\x1b[91m|********************************| \\x1b[0m',
u'\\x1b[91m 678k\\x1b[0m',
u'\\x1b[91m 0:00:00 ETA\\x1b[0m',
u'\\x1b[91m\\n\\x1b[0m',
u\"\\x1b[91m'vendor/models/1/mmod_human_face_detector.dat.bz2' saved\\n\\x1b[0m\",
u'\\x1b[91mConnecting to github.com (140.82.118.4:443)\\n\\x1b[0m',
u'\\x1b[91mConnecting to raw.githubusercontent.com (151.101.112.133:443)\\n\\x1b[0m',
u\"\\x1b[91msaving to 'vendor/models/1/dlib_face_recognition_resnet_model_v1.dat.bz2'\\n\\x1b[0m\",
u'\\x1b[91mdlib_face_recognitio \\x1b[0m',
u'\\x1b[91m100% \\x1b[0m',
u'\\x1b[91m|********************************| \\x1b[0m',
u'\\x1b[91m20.4M\\x1b[0m',
u'\\x1b[91m 0:00:00 ETA\\x1b[0m',
u'\\x1b[91m\\n\\x1b[0m',
u\"\\x1b[91m'vendor/models/1/dlib_face_recognition_resnet_model_v1.dat.bz2' saved\\n\\x1b[0m\",
u'\\x1b[91mConnecting to github.com (140.82.118.4:443)\\n\\x1b[0m',
u'\\x1b[91mConnecting to raw.githubusercontent.com (151.101.112.133:443)\\n\\x1b[0m',
u\"\\x1b[91msaving to 'vendor/models/1/shape_predictor_5_face_landmarks.dat.bz2'\\n\\x1b[0m\",
u'\\x1b[91mshape_predictor_5_fa \\x1b[0m',
u'\\x1b[91m 6% \\x1b[0m',
u'\\x1b[91m|* | \\x1b[0m',
u'\\x1b[91m 343k\\x1b[0m',
u'\\x1b[91m 0:00:15 ETA\\x1b[0m',
u'\\x1b[91m\\n\\x1b[0m',
u'\\x1b[91mshape_predictor_5_fa \\x1b[0m',
u'\\x1b[91m100% \\x1b[0m',
u'\\x1b[91m|********************************| \\x1b[0m',
u'\\x1b[91m5572k\\x1b[0m',
u'\\x1b[91m 0:00:00 ETA\\x1b[0m',
u'\\x1b[91m\\n\\x1b[0m',
u\"\\x1b[91m'vendor/models/1/shape_predictor_5_face_landmarks.dat.bz2' saved\\n\\x1b[0m\",
u'Could not open input file: test.php\\n',
u'Removing intermediate container 3bbc86385b7c\\n']"}
I made the container without the tests. I then copied/followed your testing code inside the container /tmp/../t1 directory This did not immediately work I got an error
php test.php
Fatal error: Uncaught Error: Class 'CnnFaceDetection' not found in /tmp/crop-tests/t1/crop-tests/test.php:4
Stack trace:
#0 {main}
thrown in /tmp/crop-tests/t1/crop-tests/test.php on line 4
which has to do with your line:
RUN echo "extension=pdlib.so" > /etc/php7/conf.d/pdlib.ini
This line would be better as(?):
RUN echo "extension=pdlib.so" >> <backtick>php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"<backtick>
and even this should really add a linefeed before "extension=..."
At least in my setup the conf.d setup didn't work - but maybe it does - and just needs a machine restart...
In fact in my setup - 16.04 ubuntu:
echo "extension=pdlib.so" > $(echo `php --ini | grep "Configuration File (" | sed -e "s|.*:\s*||"` | awk '{print
$1"/conf.d/pdlib.ini"}')
works on the cli (not tested in Dockerfile yet)
@james-cook Thanks for taking the time to look into this! Sorry I haven't responded for a while. No matter what I try, I cannot reproduce the error you get.
Can you try the following Dockerfile, build it with docker build -t nextcloud-facerecognition
and run it with docker run nextcloud-facerecognition
and see if it makes a difference?
FROM nextcloud:17-fpm-alpine
ADD repositories /etc/apk
RUN apk --update upgrade
RUN apk add php7-pdlib
RUN echo 'extension=/usr/lib/php7/modules/pdlib.so' > /usr/local/etc/php/conf.d/pdlib.ini
RUN echo 'memory_limit=2048M' > /usr/local/etc/php/conf.d/memory-limit.ini
# Download test and clean it
RUN wget https://github.com/matiasdelellis/facerecognition/files/3107912/crop-tests.zip \
; unzip -q crop-tests.zip \
; rm crop-tests/cropped_* \
; rm crop-tests/test.csv
# download models needed to test and execute it..
RUN cd crop-tests ; mkdir -p vendor/models/1/ \
; wget https://github.com/davisking/dlib-models/raw/94cdb1e40b1c29c0bfcaf7355614bfe6da19460e/mmod_human_face_detector.dat.bz2 -O vendor/models/1/mmod_human_face_detector.dat.bz2 \
; bzip2 -d vendor/models/1/mmod_human_face_detector.dat.bz2 \
; wget https://github.com/davisking/dlib-models/raw/2a61575dd45d818271c085ff8cd747613a48f20d/dlib_face_recognition_resnet_model_v1.dat.bz2 -O vendor/models/1/dlib_face_recognition_resnet_model_v1.dat.bz2 \
; bzip2 -d vendor/models/1/dlib_face_recognition_resnet_model_v1.dat.bz2 \
; wget https://github.com/davisking/dlib-models/raw/4af9b776281dd7d6e2e30d4a2d40458b1e254e40/shape_predictor_5_face_landmarks.dat.bz2 -O vendor/models/1/shape_predictor_5_face_landmarks.dat.bz2 \
; bzip2 -d vendor/models/1/shape_predictor_5_face_landmarks.dat.bz2
#; php test.php
ENTRYPOINT ["php", "crop-tests/test.php"]
For me, running this Dockerfile yields the dgesdd_: symbol not found
.
I was able to get a working setup with the following Dockerfile:
FROM nextcloud:18-fpm-alpine
RUN apk add -X http://dl-cdn.alpinelinux.org/alpine/edge/testing dlib
RUN wget https://github.com/goodspb/pdlib/archive/master.zip \
&& mkdir -p /usr/src/php/ext/ \
&& unzip -d /usr/src/php/ext/ master.zip \
&& rm master.zip
RUN docker-php-ext-install pdlib-master
RUN apk add bzip2-dev
RUN docker-php-ext-install bz2
Let me break it down:
docker-php-ext-install
is built into Nextcloud because it uses this base image, so pdlib is installed using this command. pdlib-master
is the name of the directory it looks for in /usr/src/php/ext
.That's it. Granted, it's a little more involved than I anticipated, but still pretty easy to setup. The building of pdlib takes some time, but it's all automated by docker-php-ext-install
and cached by the Docker daemon.
I'm in the process of updating Dlib to 19.19 in Alpine testing (current is 19.18). I'm also looking into ways to get Dlib into one of the stable repositories.
Thank you very much for all the research and progress! :smile: :smiley:
Hello everyone, Momentarily we are going to use a PDlib fork for our application.
This shouldn't affect them as much, but one of the things I hope to do is improve the documentation. For example, here is a first documentation about how to install PDlib on docker.
Well, Insist in that I have no more experience with docker, :sweat_smile: therefore I want your opinion. :smile:
Thanks, Matias
Hi Matias, this looks great! Thanks for your effort to document the Docker installation!
If it's ok, I'll leave some feedback here.
In IMHO the easiest way to install this library to a docker instance multi-stage builds to compile the library in one stage, and only copy the necessary files to the final image.
I'm having some trouble reading this sentence. The multi-stage build feature is used only in the Debian example, not with Alpine (since Dlib doesn't need to be built in Alpine). My suggestion is to rephrase it to something like this:
We are aware that many users use Docker for their Nextcloud instances.
Below are some examples and then some steps to help you quickly get started with Facerecognition using Docker.
There are two variants: Debian using Apache and Alpine using PHP FPM.
These are based on the two options available in https://github.com/nextcloud/docker
## Examples
### Extend nextcloud:apache
In this example we show how to install Dlib and PDlib from source to build a Nextcloud image with Debian and Apache.
This `Dockerfile` uses [multistage builds](https://docs.docker.com/develop/develop-images/multistage-build/) to first build the binaries of Dlib and then automatically copy the binaries to the final image.
Use it as a guide to adapt it to your needs.
(Dockerfile here)
### Extend nextcloud:18-fpm-alpine
In this example we show how to install Dlib from a repository and PDlib using [docker-php-ext-install](https://github.com/docker-library/php/) to build a Nextcloud image with Alpine and PHP FPM (for use with Nginx).
(Dockerfile here)
Some feedback on the Dockerfiles:
I've built the Dockerfile. For me it stopped at the COPY --from
commands, because the destination directory needs a trailing /
. When I added it, it worked fine:
# Install dlib and PDlib to image
COPY --from=builder /usr/local/lib/libdlib.so* /usr/local/lib/
# If is necesary take the php extention folder uncommenting the next line
# RUN php -i | grep extension_dir
COPY --from=builder /usr/local/lib/php/extensions/no-debug-non-zts-20180731/pdlib.so /usr/local/lib/php/extensions/no-debug-non-zts-20180731/
After this the image built with success and I was able to start it.
The Alpine image also works fine, but shouldn't the pdlib URL be replaced with yours? (i.e. https://github.com/goodspb/pdlib/archive/master.zip
becomes https://github.com/matiasdelellis/pdlib/archive/master.zip
)
I'm also wondering: since the Apache base image uses Debian Buster, could it be possible that Dlib is already available as binary package via apt
?
I looked around and found this: https://packages.debian.org/buster/libdlib19
Hi @agboom You're right!.. Thank you so much for the comments.. :smile:
I looked around and found this: https://packages.debian.org/buster/libdlib19
Theoretically pdlib depends 19.13, but i will try to compile it 19.10 :grimacing:
For Alpine: I've (finally) submitted the newest Dlib into community. Let's hope that it gets through :crossed_fingers: Progress can be tracked here: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/7177
Theoretically pdlib depends 19.13, but i will try to compile it 19.10
Sorry, I didn't notice the version at first, I guess it's not of much use then
I'm not really sure where else to ask and didn't want to create a new issue. For the past few days I've been messing around with docker trying to configure a build that works with Linuxserver's builds of nextcloud as well, for whatever reason I can't get reverse proxy to work with Nextcloud's official docker images.
I was able to cobble something together after looking at work from @agboom that compiles correctly, but for whatever reason when running and I try to install the Face Recognition app from the NC app store it says that pdlib isn't installed--even though it actually is.
Please help save my sanity, I just want to be able to show someone all the photos they're in from my photo library 🤣 I have a feeling I"m very close and just missing something (I'm a novice).
WARNING: super crappy/ugly dockerfile but it works and all the tests pass. The multi staging is because the Linuxserver images can't use docker-php-ext-install
for some reason. ¯_(ツ)_/¯
FROM nextcloud:fpm-alpine as helper
RUN apk add -X http://dl-cdn.alpinelinux.org/alpine/edge/testing dlib
RUN wget https://github.com/goodspb/pdlib/archive/master.zip \
&& mkdir -p /usr/src/php/ext/ \
&& unzip -d /usr/src/php/ext/ master.zip \
&& rm master.zip
RUN docker-php-ext-install pdlib-master
RUN apk add bzip2-dev
RUN docker-php-ext-install bz2
FROM linuxserver/nextcloud:latest
RUN apk update
RUN apk add libzip-dev autoconf build-base nginx oniguruma openldap-dev openblas-dev musl-dev php7-fpm
RUN apk add php7-pdlib --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
RUN apk add -X http://dl-cdn.alpinelinux.org/alpine/edge/testing dlib
RUN wget https://github.com/goodspb/pdlib/archive/master.zip \
&& mkdir -p /usr/src/php/ext/ \
&& unzip -d /usr/src/php/ext/ master.zip \
&& rm master.zip
RUN apk add bzip2-dev
ENV PATH "$PATH:/usr/local/bin/"
COPY --from=helper /usr/src/ /usr/src/
COPY --from=helper /usr/local/ /usr/local/
RUN echo memory_limit=-1 > /usr/local/etc/php/conf.d/memory-limit.ini
RUN docker-php-ext-install pdo_mysql
RUN docker-php-ext-install pdlib-master
RUN docker-php-ext-install bz2
ENV PATH "$PATH:/usr/local/bin/"
RUN PHP_INI_DIR=/usr/local/etc/php/conf.d
RUN echo "extension=pdlib.so" > /usr/local/etc/php/conf.d/pdlib.ini
RUN apk update && apk upgrade
RUN apk add git wget
RUN git clone https://github.com/matiasdelellis/pdlib-min-test-suite.git \
&& cd pdlib-min-test-suite \
&& make
edit: forgot to mention I'm running docker on unraid--unraid PHP is version 7.3.14 (cli) And the container PHP version is listed here showing pdlib.
But logs show this
Hey guys, I've build a docker image and published it on docker hub. I will maintain this image. Everything is build on top of the official nextcloud apache image. Feel free to use it: https://hub.docker.com/r/iamklaus/nextcloud
Thank you very much! Could you also port the latest nextcloud-fpm-alpine image?
@ACarolan Did you ever manage to get it working for you? I'm currently in the same situation
@ACarolan Did you ever manage to get it working for you? I'm currently in the same situation
I did, I used @iamklaus 's docker image posted above with a couple tweaks. There were one or two things for my setup that didn't work so I abandoned it after also realizing it wouldn't be able to do what I wanted it to do.
if anyone is still interested, here is a currently working setup for alpine fpm and nextcloud 24
FROM nextcloud:24.0-fpm-alpine
# update alpine to edge
RUN sed -i -e 's/v3\.15/edge/g' /etc/apk/repositories
RUN apk upgrade
# add dlib and bz2
RUN apk --update add --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing php8-pdlib php8-bz2
RUN cp /usr/lib/php8/modules/pdlib.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/pdlib.so
RUN cp /usr/lib/php8/modules/bz2.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
RUN cp /etc/php8/conf.d/pdlib.ini /usr/local/etc/php/conf.d/pdlib.ini
RUN cp /etc/php8/conf.d/00_bz2.ini /usr/local/etc/php/conf.d/bz2.ini
I am also under an alpine image, so I can't use Face Recognition :(
FROM nextcloud:24.0-fpm-alpine
update alpine to edge
RUN sed -i -e 's/v3.15/edge/g' /etc/apk/repositories RUN apk upgrade
add dlib and bz2
RUN apk --update add --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing php8-pdlib php8-bz2 RUN cp /usr/lib/php8/modules/pdlib.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/pdlib.so RUN cp /usr/lib/php8/modules/bz2.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/ RUN cp /etc/php8/conf.d/pdlib.ini /usr/local/etc/php/conf.d/pdlib.ini RUN cp /etc/php8/conf.d/00_bz2.ini /usr/local/etc/php/conf.d/bz2.ini
Know how to get this to work with 25?
Hi everyone,
We are going to try to use PECL, and maybe it will be interesting for all of you.
See: https://github.com/goodspb/pdlib/issues/56#issuecomment-1452714399
For anyone using docker images based on alpine from linuxserver (https://hub.docker.com/r/linuxserver/nextcloud)
I made it working using this compose file:
---
version: "2.1"
services:
nextcloud:
#image: lscr.io/linuxserver/nextcloud
build:
context: ./build
dockerfile: Dockerfile
container_name: nextcloud
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Rome
volumes:
- ./config:/config
- /var/lib/nextcloud:/data
ports:
- 4443:443
restart: always
healthcheck:
test: curl -sS https://127.0.0.1 || exit 1
interval: 10s
timeout: 30s
retries: 6
And this Dockerfile:
FROM lscr.io/linuxserver/nextcloud:latest
RUN apk add --no-cache --upgrade make cmake gcc g++ php81-dev libx11-dev openblas-dev re2c ffmpeg-dev
WORKDIR /
RUN git clone https://github.com/davisking/dlib.git
WORKDIR dlib/dlib
RUN mkdir build
WORKDIR build
RUN cmake -DBUILD_SHARED_LIBS=ON ..
RUN make -j4
RUN make install
WORKDIR /
RUN git clone https://github.com/goodspb/pdlib.git
WORKDIR pdlib
RUN phpize
RUN PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig ./configure
RUN make -j4
RUN make install
WORKDIR /
RUN rm -rf /dlib /pdlib
Using custom init scripts inside custom-cont-init.d directory as described here to build dlib and pdlib doesn't work, cmake returns a strange error which I haven't investigate. Has something to do with characters escape.
But extending the main linuxserver Dockerfile and building the image myself, solved the problem.
Also remember to add
[pdlib]
extension="pdlib.so"
to config/php/php-local.ini
For proxmox Alpine Nextcloud Hub version 27, modified @blastbeng solution is working:
apk add --no-cache --upgrade make cmake gcc g++ php82-dev libx11-dev openblas-dev re2c ffmpeg-dev libjpeg-turbo-dev
*note php82-dev and libjpeg-turbo-dev needed for below builds:
Follow build instructions from https://github.com/goodspb/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
git clone https://github.com/goodspb/pdlib.git cd pdlib phpize ./configure --enable-debug PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --enable-debug make sudo make install
Background
This is a continuation of the discussion in #214, where one of the goals was to install Facerecognition using precompiled binaries in Alpine Linux. Alpine Linux is a small and simple Linux distribution, which makes it suitable for Docker based applications, due to its small footprint. Nextcloud provides Docker images based on Alpine Linux, with the tags suffixed with
-alpine
. Previous work has been done in #160 to compile the binaries manually using a Dockerfile.Purpose
apk
).Current situation
We have packages for both
dlib
andphp7-pdlib
in the testing repository of Alpine, merged with these PRs:While the projects compile and the compiled binaries are present, loading the PDLib binaries cause a runtime error:
What needs to be done
Test setup/how to reproduce
I've created a Dockerfile to test the package.
Where
repositories
is:Building and running this with:
Yields the above runtime error.