This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
forked from matomo-org/docker
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile-alpine.template
117 lines (104 loc) · 3.67 KB
/
Dockerfile-alpine.template
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
FROM php:7.4-%%VARIANT%%
LABEL maintainer="pierre@piwik.org"
RUN set -ex; \
\
apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
autoconf \
freetype-dev \
icu-dev \
libjpeg-turbo-dev \
libpng-dev \
libzip-dev \
openldap-dev \
pcre-dev \
; \
\
docker-php-ext-configure gd --with-freetype --with-jpeg; \
docker-php-ext-configure ldap; \
docker-php-ext-install -j "$(nproc)" \
gd \
ldap \
mysqli \
opcache \
pdo_mysql \
zip \
; \
\
# pecl will claim success even if one install fails, so we need to perform each install separately
pecl install APCu-5.1.18; \
pecl install redis-5.3.1; \
\
docker-php-ext-enable \
apcu \
redis \
; \
\
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)"; \
apk add --no-cache --virtual .matomo-phpext-rundeps $runDeps mariadb-client; \
apk del .build-deps
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=2'; \
echo 'opcache.fast_shutdown=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
ENV MATOMO_VERSION %%VERSION%%
RUN set -ex; \
apk add --no-cache --virtual .fetch-deps \
gnupg \
; \
\
curl -fsSL -o matomo.tar.gz \
"https://builds.matomo.org/matomo-${MATOMO_VERSION}.tar.gz"; \
curl -fsSL -o matomo.tar.gz.asc \
"https://builds.matomo.org/matomo-${MATOMO_VERSION}.tar.gz.asc"; \
export GNUPGHOME="$(mktemp -d)"; \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 814E346FA01A20DBB04B6807B5DBD5925590A237; \
gpg --batch --verify matomo.tar.gz.asc matomo.tar.gz; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME" matomo.tar.gz.asc; \
tar -xzf matomo.tar.gz -C /usr/src/; \
rm matomo.tar.gz; \
apk del .fetch-deps
RUN curl -fsSL -o geoip.gz \
"https://download.db-ip.com/free/dbip-city-lite-$(date +%Y-%m).mmdb.gz" && \
mkdir -p /var/geoip/ && \
gunzip -c geoip.gz > /var/geoip/DBIP-City.mmdb && \
rm geoip.gz
COPY php.ini /usr/local/etc/php/conf.d/php-matomo.ini
COPY www.conf.default /usr/local/etc/php-fpm.d/www.conf.default
# https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases/
#RUN set -ex; \
# curl -fsSL -o GeoIPCity.tar.gz \
# "https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz"; \
# curl -fsSL -o GeoIPCity.tar.gz.md5 \
# "https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz.md5"; \
# echo "$(cat GeoIPCity.tar.gz.md5) GeoIPCity.tar.gz" | md5sum -c -; \
# mkdir /usr/src/GeoIPCity; \
# tar -xf GeoIPCity.tar.gz -C /usr/src/GeoIPCity --strip-components=1; \
# mv /usr/src/GeoIPCity/GeoLite2-City.mmdb /usr/src/matomo/misc/GeoLite2-City.mmdb; \
# rm -rf GeoIPCity*
RUN set -ex; \
apk add --no-cache --virtual .fetch-deps unzip; \
curl -fsSL -o EnvironmentVariables.zip \
"https://plugins.matomo.org/api/2.0/plugins/EnvironmentVariables/download/4.0.1"; \
unzip '*.zip' -d /usr/src/matomo/plugins; \
apk del .fetch-deps; \
rm *.zip;
COPY --chown=1000:1000 common.config.ini.php /usr/src/matomo/config/common.config.ini.php
COPY --chown=1000:1000 bootstrap.php /usr/src/matomo/bootstrap.php
COPY docker-entrypoint.sh /entrypoint.sh
# WORKDIR is /var/www/html (inherited via "FROM php")
# "/entrypoint.sh" will populate it at container startup from /usr/src/matomo
VOLUME /data
ENTRYPOINT ["/entrypoint.sh"]
CMD ["%%CMD%%"]