-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile
135 lines (116 loc) · 4.23 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# iamklaus/nextcloud:fpm - ENJOY IT
# Use a temporary image to compile and test the libraries
FROM nextcloud:fpm as builder
# Build and install dlib on builder
RUN apt-get update ; \
apt-get install -y build-essential wget cmake libx11-dev libopenblas-dev shtool
ARG DLIB_BRANCH=master
RUN cd; \
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
# Build and install PDLib on builder
ARG PDLIB_BRANCH=master
RUN apt-get install unzip
RUN cd; \
wget -c -q https://github.com/matiasdelellis/pdlib/archive/$PDLIB_BRANCH.zip \
&& unzip $PDLIB_BRANCH \
&& mv pdlib-* pdlib \
&& cd pdlib \
&& phpize \
&& ./configure \
&& make \
&& make install
# Enable PDlib on builder
# If necesary take the php settings folder uncommenting the next line
# RUN php -i | grep "Scan this dir for additional .ini files"
RUN echo "extension=pdlib.so" > /usr/local/etc/php/conf.d/pdlib.ini
# Test PDlib installation on builer
RUN apt-get install -y git
RUN cd; \
git clone https://github.com/matiasdelellis/pdlib-min-test-suite.git \
&& cd pdlib-min-test-suite \
&& make
# If pass the tests, we are able to create the final image.
FROM nextcloud:fpm
# Install dependencies to image
RUN apt-get update ; \
apt-get install -y libopenblas-base
# 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 $(php -r "echo ini_get ('extension_dir');")/pdlib.so $(php -r "echo ini_get ('extension_dir');")/
COPY --from=builder /usr/local/lib/php/extensions/no-debug-non-zts-20200930/pdlib.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
# Enable PDlib on final image
RUN echo "extension=pdlib.so" > /usr/local/etc/php/conf.d/pdlib.ini
# Set ENV varaiable for PHP memory limits (can be adjusted in docker)
RUN echo 'memory_limit=${MEMORY_LIMIT}' > /usr/local/etc/php/conf.d/memory-limit.ini
# At this point you meet all the dependencies to install the application
# If is available you can skip this step and install the application from the application store
ARG FR_BRANCH=master
RUN apt-get install -y wget unzip nodejs npm
RUN wget -c -q -O facerecognition https://github.com/matiasdelellis/facerecognition/archive/$FR_BRANCH.zip \
&& unzip facerecognition \
&& mv facerecognition-* /usr/src/nextcloud/facerecognition \
&& cd /usr/src/nextcloud/facerecognition \
&& make
RUN set -ex; \
apt-get update; \
apt-get install -y --no-install-recommends \
ffmpeg \
libmagickcore-6.q16-6-extra \
procps \
smbclient \
supervisor \
libreoffice \
vim \
libfuse2 \
fuse \
fontconfig \
exiftool \
gnupg
RUN set -ex; \
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
libbz2-dev \
libc-client-dev \
libkrb5-dev \
libsmbclient-dev \
; \
\
docker-php-ext-configure imap --with-kerberos --with-imap-ssl; \
docker-php-ext-install \
bz2 \
imap \
; \
pecl install smbclient; \
docker-php-ext-enable smbclient; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
| awk '/=>/ { print $3 }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
RUN mkdir -p \
/var/log/supervisord \
/var/run/supervisord
COPY supervisord.conf /
ENV NEXTCLOUD_UPDATE=1
ENV PHP_MEMORY_LIMIT=1G
RUN echo '*/30 * * * * php -f /var/www/html/occ face:background_job -t 900' >> /var/spool/cron/crontabs/www-data
CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"]