mirror of
https://github.com/hoellen/dockerfiles.git
synced 2025-04-19 20:09:16 +00:00
piwik: migrate underlying image to nginx-php
This commit is contained in:
parent
8f7a3f8f3b
commit
71f4262193
@ -1,9 +1,12 @@
|
||||
FROM alpine:3.5
|
||||
FROM wonderfall/nginx-php
|
||||
|
||||
ARG VERSION=3.0.3
|
||||
ARG GPG_matthieu="814E 346F A01A 20DB B04B 6807 B5DB D592 5590 A237"
|
||||
|
||||
ENV UID=991 GID=991
|
||||
ENV UID=991 GID=991 \
|
||||
UPLOAD_MAX_SIZE=10M \
|
||||
MEMORY_LIMIT=256M \
|
||||
OPCACHE_MEM_SIZE=128M
|
||||
|
||||
RUN BUILD_DEPS=" \
|
||||
git \
|
||||
@ -16,31 +19,10 @@ RUN BUILD_DEPS=" \
|
||||
gnupg" \
|
||||
&& apk -U upgrade && apk add \
|
||||
${BUILD_DEPS} \
|
||||
nginx \
|
||||
s6 \
|
||||
su-exec \
|
||||
geoip \
|
||||
tzdata \
|
||||
php7-fpm \
|
||||
php7-gd \
|
||||
php7-curl \
|
||||
php7-session \
|
||||
php7-json \
|
||||
php7-ctype \
|
||||
php7-mbstring \
|
||||
php7-iconv \
|
||||
php7-zlib \
|
||||
php7-dom \
|
||||
php7-openssl \
|
||||
php7-mysqli \
|
||||
php7-mysqlnd \
|
||||
php7-pdo \
|
||||
php7-pdo_mysql \
|
||||
php7-dev \
|
||||
php7-pear \
|
||||
&& sed -i "$ s|\-n||g" /usr/bin/pecl && pecl install geoip-1.1.1 \
|
||||
&& echo 'extension=geoip.so' >> /etc/php7/conf.d/00_geoip.ini \
|
||||
&& echo 'geoip.custom_directory=/piwik/misc' >> /etc/php7/php.ini \
|
||||
&& pecl install geoip-1.1.1 \
|
||||
&& echo 'extension=geoip.so' >> /php/conf.d/geoip.ini \
|
||||
&& mkdir /piwik && cd /tmp \
|
||||
&& PIWIK_TARBALL="piwik-${VERSION}.tar.gz" \
|
||||
&& wget -q https://builds.piwik.org/${PIWIK_TARBALL} \
|
||||
@ -54,16 +36,13 @@ RUN BUILD_DEPS=" \
|
||||
&& if [ "${FINGERPRINT}" != "${GPG_matthieu}" ]; then echo "Warning! Wrong GPG fingerprint!" && exit 1; fi \
|
||||
&& echo "All seems good, now unpacking ${PIWIK_TARBALL}..." \
|
||||
&& tar xzf ${PIWIK_TARBALL} --strip 1 -C /piwik \
|
||||
&& wget -q https://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz -P /piwik/misc \
|
||||
&& gzip -d /piwik/misc/GeoLiteCity.dat.gz \
|
||||
&& mv /piwik/misc/GeoLiteCity.dat /piwik/misc/GeoIPCity.dat \
|
||||
&& wget -q https://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz -P /usr/share/GeoIP/ \
|
||||
&& gzip -d /usr/share/GeoIP/GeoLiteCity.dat.gz \
|
||||
&& mv /usr/share/GeoIP/GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat \
|
||||
&& apk del ${BUILD_DEPS} php7-dev php7-pear \
|
||||
&& rm -rf /var/cache/apk/* /tmp/* /root/.gnupg
|
||||
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
COPY php-fpm.conf /etc/php7/php-fpm.conf
|
||||
COPY s6.d /etc/s6.d
|
||||
COPY run.sh /usr/local/bin/run.sh
|
||||
COPY rootfs /
|
||||
|
||||
RUN chmod +x /usr/local/bin/run.sh /etc/s6.d/*/* /etc/s6.d/.s6-svscan/*
|
||||
|
||||
|
@ -1,11 +0,0 @@
|
||||
[global]
|
||||
daemonize = no
|
||||
|
||||
[www]
|
||||
listen = /tmp/php-fpm.sock
|
||||
pm = dynamic
|
||||
pm.max_children = 5
|
||||
pm.start_servers = 2
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 3
|
||||
chdir = /
|
@ -1,57 +1,4 @@
|
||||
worker_processes auto;
|
||||
pid /tmp/nginx.pid;
|
||||
daemon off;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
use epoll;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
access_log off;
|
||||
error_log /tmp/ngx_error.log error;
|
||||
|
||||
fastcgi_temp_path /tmp/fastcgi 1 2;
|
||||
client_body_temp_path /tmp/client_body 1 2;
|
||||
proxy_temp_path /tmp/proxy 1 2;
|
||||
uwsgi_temp_path /tmp/uwsgi 1 2;
|
||||
scgi_temp_path /tmp/scgi 1 2;
|
||||
|
||||
sendfile on;
|
||||
keepalive_timeout 15;
|
||||
keepalive_disable msie6;
|
||||
keepalive_requests 100;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
server_tokens off;
|
||||
|
||||
gzip on;
|
||||
gzip_comp_level 5;
|
||||
gzip_min_length 512;
|
||||
gzip_buffers 4 8k;
|
||||
gzip_proxied any;
|
||||
gzip_vary on;
|
||||
gzip_disable "msie6";
|
||||
gzip_types
|
||||
text/css
|
||||
text/javascript
|
||||
text/xml
|
||||
text/plain
|
||||
text/x-component
|
||||
application/javascript
|
||||
application/x-javascript
|
||||
application/json
|
||||
application/xml
|
||||
application/rss+xml
|
||||
application/vnd.ms-fontobject
|
||||
font/truetype
|
||||
font/opentype
|
||||
image/svg+xml;
|
||||
|
||||
server {
|
||||
server {
|
||||
listen 8888;
|
||||
root /piwik;
|
||||
index index.php index.html;
|
||||
@ -92,11 +39,8 @@ http {
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_index index.php;
|
||||
fastcgi_pass unix:/tmp/php-fpm.sock;
|
||||
fastcgi_pass unix:/php/run/php-fpm.sock;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include /etc/nginx/fastcgi_params;
|
||||
include /nginx/conf/fastcgi_params;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
8
piwik/rootfs/php/conf.d/opcache.ini
Normal file
8
piwik/rootfs/php/conf.d/opcache.ini
Normal file
@ -0,0 +1,8 @@
|
||||
zend_extension=opcache.so
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.fast_shutdown=1
|
||||
opcache.memory_consumption=<OPCACHE_MEM_SIZE>
|
||||
opcache.interned_strings_buffer=16
|
||||
opcache.max_accelerated_files=10000
|
||||
opcache.revalidate_freq=60
|
13
piwik/rootfs/usr/local/bin/run.sh
Normal file
13
piwik/rootfs/usr/local/bin/run.sh
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
sed -i -e "s/<UPLOAD_MAX_SIZE>/$UPLOAD_MAX_SIZE/g" /nginx/conf/nginx.conf /php/etc/php-fpm.conf \
|
||||
-e "s/<MEMORY_LIMIT>/$MEMORY_LIMIT/g" /php/etc/php-fpm.conf \
|
||||
-e "s/<OPCACHE_MEM_SIZE>/$OPCACHE_MEM_SIZE/g" /php/conf.d/opcache.ini
|
||||
|
||||
if [ ! -f /config/config.ini.php ]; then
|
||||
cp /piwik/config/config.ini.php /config/config.ini.php
|
||||
fi
|
||||
|
||||
ln -s /config/config.ini.php /piwik/config/config.ini.php
|
||||
mv piwik fix && mv fix piwik # fix strange bug
|
||||
chown -R $UID:$GID /piwik /config /var/log /php /nginx /tmp /usr/share/GeoIP /etc/s6.d
|
||||
exec su-exec $UID:$GID /bin/s6-svscan /etc/s6.d
|
10
piwik/run.sh
10
piwik/run.sh
@ -1,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -f /config/config.ini.php ]; then
|
||||
cp /piwik/config/config.ini.php /config/config.ini.php
|
||||
fi
|
||||
|
||||
ln -s /config/config.ini.php /piwik/config/config.ini.php
|
||||
mv piwik fix && mv fix piwik # fix strange bug
|
||||
chown -R $UID:$GID /piwik /config /var/log /etc/nginx /etc/php7 /var/lib/nginx /tmp /etc/s6.d
|
||||
exec su-exec $UID:$GID /bin/s6-svscan /etc/s6.d
|
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
exit 0
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
exec nginx
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
exec php-fpm7
|
Loading…
x
Reference in New Issue
Block a user