forked from br2490/isle-apache
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile
293 lines (279 loc) · 12.1 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# @see https://github.com/adoptium/containers/blob/main/8/jdk/ubuntu/focal/Dockerfile.releases.full for newer supported java updates
FROM eclipse-temurin:8-jdk-focal
ENV INITRD=no \
ISLANDORA_UID=${ISLANDORA_UID:-1000} \
ENABLE_XDEBUG=${ENABLE_XDEBUG:-false} \
PULL_ISLE_BUILD_TOOLS=${PULL_ISLE_BUILD_TOOLS:-true} \
ISLE_BUILD_TOOLS_REPO=${ISLE_BUILD_TOOLS_REPO:-https://github.com/Islandora-Collaboration-Group/isle_drupal_build_tools.git} \
ISLE_BUILD_TOOLS_BRANCH=${ISLE_BUILD_TOOLS_BRANCH:-master}
## @TODO: add GH creds to container for private repo pulls.
## General Dependencies
RUN GEN_DEP_PACKS="software-properties-common \
language-pack-en-base \
tmpreaper \
cron \
dnsutils \
wget \
rsync \
git \
unzip \
tmpreaper \
libapr1-dev \
libssl-dev \
xz-utils \
zip \
bzip2 \
openssl \
openssh-client \
mysql-client\
file" && \
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections && \
apt-get update && \
apt-get install --no-install-recommends -y $GEN_DEP_PACKS && \
## CONFD
curl -L -o /usr/local/bin/confd https://github.com/kelseyhightower/confd/releases/download/v0.16.0/confd-0.16.0-linux-amd64 && \
chmod +x /usr/local/bin/confd && \
## Cleanup phase.
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
## S6-Overlay
# @see: https://github.com/just-containers/s6-overlay
ENV S6_OVERLAY_VERSION=${S6_OVERLAY_VERSION:-2.2.0.3}
ADD https://github.com/just-containers/s6-overlay/releases/download/v$S6_OVERLAY_VERSION/s6-overlay-amd64-installer /tmp/
RUN chmod +x /tmp/s6-overlay-amd64-installer && \
/tmp/s6-overlay-amd64-installer /
ENV LC_ALL=en_US.UTF-8 \
LANG=en_US.UTF-8 \
LANGUAGE=en_US:en
## tmpreaper - cleanup /tmp on the running container
RUN touch /var/log/cron.log && \
touch /etc/cron.d/tmpreaper-cron && \
echo "0 */12 * * * root /usr/sbin/tmpreaper -am 4d /tmp >> /var/log/cron.log 2>&1" | tee /etc/cron.d/tmpreaper-cron && \
chmod 0644 /etc/cron.d/tmpreaper-cron
# @see: ImageMagick https://github.com/ImageMagick/ImageMagick/releases
ENV PATH=$PATH:$HOME/.composer/vendor/bin \
KAKADU_HOME=/usr/local/adore-djatoka-1.1/bin/Linux-x86-64 \
KAKADU_LIBRARY_PATH=/usr/local/adore-djatoka-1.1/lib/Linux-x86-64 \
LD_LIBRARY_PATH=/usr/local/adore-djatoka-1.1/lib/Linux-x86-64:/usr/local/lib:$LD_LIBRARY_PATH \
COMPOSER_ALLOW_SUPERUSER=1 \
IMAGEMAGICK_VERSION=${IMAGEMAGICK_VERSION:-7.1.1-25} \
OPENJPEG_VERSION=${OPENJPEG_VERSION:-v2.5.0}
## Apache, PHP, FFMPEG, and other Islandora Depends.
## Apache && PHP 7.1 from ondrej PPA
## Per @g7morris, ghostscript from repo is OK.
RUN add-apt-repository -y ppa:ondrej/apache2 && \
add-apt-repository -y ppa:ondrej/php && \
FFMPEG_PACKS="ffmpeg \
ffmpeg2theora \
libavcodec-extra \
lame \
ghostscript \
poppler-utils" && \
APACHE_PACKS="apache2 \
libxml2-dev \
libapache2-mod-php7.1 \
libcurl4-openssl-dev \
php7.1 \
php7.1-cli \
php7.1-json \
php7.1-common \
php7.1-readline \
php-pear \
php7.1-curl \
php7.1-mbstring \
php7.1-xmlrpc \
php7.1-dev \
php7.1-gd \
php7.1-ldap \
php7.1-xml \
php7.1-mcrypt \
php7.1-mysql \
php7.1-soap \
php7.1-xsl \
php7.1-zip \
php7.1-bcmath \
php7.1-intl \
php-uploadprogress \
php-xdebug \
bibutils \
libicu-dev \
tesseract-ocr \
tesseract-ocr-eng \
tesseract-ocr-fra \
tesseract-ocr-spa \
tesseract-ocr-ita \
tesseract-ocr-por \
tesseract-ocr-hin \
tesseract-ocr-deu \
tesseract-ocr-jpn \
tesseract-ocr-rus \
leptonica-progs \
libleptonica-dev" && \
apt-get update && \
apt-get install --no-install-recommends -y $FFMPEG_PACKS $APACHE_PACKS && \
update-alternatives --set php /usr/bin/php7.1 && \
## PHP conf
phpdismod xdebug && \
## memory_limit = -1?
sed -i 's/memory_limit = .*/memory_limit = '256M'/' /etc/php/7.1/apache2/php.ini && \
sed -i 's/upload_max_filesize = .*/upload_max_filesize = '2000M'/' /etc/php/7.1/apache2/php.ini && \
sed -i 's/post_max_size = .*/post_max_size = '2000M'/' /etc/php/7.1/apache2/php.ini && \
sed -i 's/max_input_time = .*/max_input_time = '-1'/' /etc/php/7.1/apache2/php.ini && \
sed -i 's/max_execution_time = .*/max_execution_time = '0'/' /etc/php/7.1/apache2/php.ini && \
## Cleanup phase.
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
###
# FFMPEG, ImageMagick, Imagick (php), Adore-Djatoka (Kakadu), and OpenJPG
RUN BUILD_DEPS="build-essential \
cmake \
pkg-config \
libtool" && \
IMAGEMAGICK_LIBS="libbz2-dev \
libdjvulibre-dev \
libexif-dev \
libgif-dev \
libjpeg8 \
libjpeg-dev \
liblqr-dev \
libopenexr-dev \
libopenjp2-7-dev \
libpng-dev \
libraw-dev \
librsvg2-dev \
libtiff-dev \
liblcms2-dev \
libzstd-dev \
libz-dev \
libwmf-dev \
libwebp-dev \
libwmf-dev \
libltdl-dev \
zlib1g-dev" && \
## I believe these are unused and actually install by libavcodec-extra.
IMAGEMAGICK_LIBS_EXTENDED="libfontconfig \
libfreetype6-dev" && \
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections && \
apt-get update && \
apt-get install -y --no-install-recommends -o APT::Get::Install-Automatic=true $BUILD_DEPS && \
# apt-mark auto $BUILD_DEPS software-properties-common && \
apt-get install -y --no-install-recommends $IMAGEMAGICK_LIBS && \
## WARC TOOLS
apt-get install -y --no-install-recommends python3-pip && \
pip3 install warctools && \
## Adore-Djatoka
cd /tmp && \
## Kakadu libraries from adore-djatoka for JP2 derivatives.
curl -LO http://downloads.sourceforge.net/project/djatoka/djatoka/1.1/adore-djatoka-1.1.tar.gz && \
tar -xzf adore-djatoka-1.1.tar.gz -C /usr/local && \
ln -s /usr/local/adore-djatoka-1.1/bin/Linux-x86-64/kdu_compress /usr/local/bin/kdu_compress && \
ln -s /usr/local/adore-djatoka-1.1/bin/Linux-x86-64/kdu_expand /usr/local/bin/kdu_expand && \
ln -s /usr/local/adore-djatoka-1.1/lib/Linux-x86-64/libkdu_a60R.so /usr/local/lib/libkdu_a60R.so && \
ln -s /usr/local/adore-djatoka-1.1/lib/Linux-x86-64/libkdu_jni.so /usr/local/lib/libkdu_jni.so && \
ln -s /usr/local/adore-djatoka-1.1/lib/Linux-x86-64/libkdu_v60R.so /usr/local/lib/libkdu_v60R.so && \
echo "/usr/local/adore-djatoka-1.1/lib/Linux-x86-64" > /etc/ld.so.conf.d/kdu_libs.conf && \
ldconfig && \
cd /usr/local/adore-djatoka-1.1/bin && \
rm -rf *.bat Solaris-Sparc Solaris-Sparcv9 Solaris-x86 Win32 ../dist/adore-djatoka.war && \
## OpenJPEG 2000
cd /tmp && \
git clone -b $OPENJPEG_VERSION https://github.com/uclouvain/openjpeg && \
cd openjpeg && \
mkdir build && cd build && \
cmake .. -DCMAKE_BUILD_TYPE=Release && \
make && \
make install && \
ldconfig && \
## ImageMagick latest
cd /tmp && \
curl -O -L https://github.com/ImageMagick/ImageMagick/archive/$IMAGEMAGICK_VERSION.tar.gz && \
tar xf $IMAGEMAGICK_VERSION.tar.gz && \
cd ImageMagick-$IMAGEMAGICK_VERSION && \
./configure --enable-hdri --with-quantum-depth=16 --without-magick-plus-plus --without-perl --with-rsvg && \
make && \
make install && \
ldconfig && \
## PHP ImageMagick latest (IMagick)
cd /tmp && \
curl -O -L http://pecl.php.net/get/imagick && \
tar xf imagick && \
cd imagick-* && \
phpize && \
./configure --with-imagick=/usr/local/bin && \
make && \
make install && \
echo '; configuration for php imagick module \nextension=imagick.so' > /etc/php/7.1/mods-available/imagick.ini && \
phpenmod imagick && \
## Cleanup phase.
apt-get purge $BUILD_DEPS software-properties-common -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Composer & FITS ENV
# @see: Composer https://github.com/composer/getcomposer.org/tree/main/web/download check if new version otherwise don't move on
# @see: if new Composer 1.x version then replace commit hash below https://github.com/composer/getcomposer.org/commits/main
# @see: FITS https://projects.iq.harvard.edu/fits/downloads
# @see: XERCES https://xerces.apache.org/mirrors.cgi for the new xml-api.jar version.
ENV COMPOSER_HASH=${COMPOSER_HASH:-315c281a794f788242d2a740de10f78eb4587d69} \
COMPOSER_VERSION=${COMPOSER_VERSION:-1.10.27} \
FITS_VERSION=${FITS_VERSION:-1.5.1} \
XERCES_VERSION=${XERCES_VERSION:-2.12.2} \
XERCES_VERSION_DIR=${XERCES_VERSION_DIR:-2_12_2}
## Let's go! Finalize all remaining: djatoka, composer, drush, fits.
# @see: Drush https://github.com/drush-ops/drush/tags
RUN useradd --comment 'Islandora User' --no-create-home -d /var/www/html --system --uid $ISLANDORA_UID --user-group -s /bin/bash islandora && \
chown -R islandora:www-data /var/www/html && \
## Temporary directory for composer, fits, etc...
mkdir -p /tmp/build && \
cd /tmp/build/ && \
## COMPOSER
wget -O composer-setup.php https://raw.githubusercontent.com/composer/getcomposer.org/$COMPOSER_HASH/web/installer && \
php composer-setup.php --version=$COMPOSER_VERSION --filename=composer --install-dir=/usr/local/bin && \
## DRUSH 8.x as recommended by @g7morris
mkdir -p /opt/drush-8.x && \
cd /opt/drush-8.x && \
/usr/local/bin/composer init --require=drush/drush:8.* -n && \
/usr/local/bin/composer config bin-dir /usr/local/bin && \
/usr/local/bin/composer install && \
## FITS
cd /tmp/build/ && \
curl -O -L https://github.com/harvard-lts/fits/releases/download/$FITS_VERSION/fits-$FITS_VERSION.zip && \
mkdir fits-$FITS_VERSION && \
unzip fits-$FITS_VERSION.zip -d fits-$FITS_VERSION && \
mv fits-$FITS_VERSION /usr/local/fits && \
ln -s /usr/local/fits/fits.sh /usr/local/bin/fits && \
## The following line will remove TikaTool operations while FITS generates technical metadata, preventing Tika temp files from maxing out disk space as described in ISLE Issue #96. Remove to allow Tika to run
sed -ie 's/<tool class="edu\.harvard\.hul\.ois\.fits\.tools\.tika\.TikaTool" exclude-exts="jar,avi,mov,mpg,mpeg,mkv,mp4,mpeg4,m2ts,mxf,ogv,mj2,divx,dv,m4v,m2v,ismv" classpath-dirs="lib\/tika"\/>/<!-- & -->/' /usr/local/fits/xml/fits.xml && \
## As of FITS 1.5.1 - Missing xml-apis.jar file causes errors in creating derivatives. Adding here
## Xerces2 Java is a library for parsing, validating and manipulating XML documents.
## https://xerces.apache.org
curl -O -L https://dlcdn.apache.org/xerces/j/binaries/Xerces-J-bin.$XERCES_VERSION.zip && \
unzip Xerces-J-bin.$XERCES_VERSION.zip -d xerces-$XERCES_VERSION && \
cp xerces-$XERCES_VERSION/xerces-$XERCES_VERSION_DIR/xml-apis.jar /usr/local/fits/lib/ && \
## BUILD TOOLS
mkdir /utility-scripts && \
cd /utility-scripts && \
git clone $ISLE_BUILD_TOOLS_REPO -b $ISLE_BUILD_TOOLS_BRANCH isle_drupal_build_tools && \
## Disable Default
a2dissite 000-default && \
a2enmod rewrite deflate headers expires proxy proxy_http proxy_html proxy_connect remoteip xml2enc cache_disk && \
## Cleanup phase.
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ARG BUILD_DATE
ARG VCS_REF
ARG VERSION
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="ISLE Apache Image" \
org.label-schema.description="Primary Islandora Image." \
org.label-schema.url="https://islandora-collaboration-group.github.io" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/Islandora-Collaboration-Group/isle-apache" \
org.label-schema.vendor="Islandora Collaboration Group (ICG) - [email protected]" \
org.label-schema.version=$VERSION \
org.label-schema.schema-version="1.0" \
traefik.port="80" \
traefik.frontend.entryPoints=http,https
COPY rootfs /
EXPOSE 80
ENTRYPOINT ["/init"]