mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2024-12-12 10:45:14 +02:00
php-fpm dockerfile simplification
By using Alpine pkgs instead of the official php base image the image size has been reduced from 459 MB to 55.7 MB a reduction of a whooping 403.3 MB :D
This commit is contained in:
parent
e151e32730
commit
9ee00c9933
@ -1,17 +1,52 @@
|
|||||||
FROM php:7.1-fpm-alpine
|
FROM alpine:3.6
|
||||||
|
|
||||||
LABEL maintainer "Andre Peters <andre.peters@servercow.de>"
|
LABEL maintainer "Andre Peters <andre.peters@servercow.de>"
|
||||||
|
|
||||||
RUN apk add -U --no-cache libxml2-dev icu-dev icu-libs redis mysql-client bash autoconf g++ make openssl
|
# Add script
|
||||||
RUN pecl install redis && pecl clear-cache
|
COPY docker-entrypoint.sh /
|
||||||
RUN docker-php-ext-configure intl
|
|
||||||
RUN docker-php-ext-install intl pdo pdo_mysql xmlrpc
|
|
||||||
RUN docker-php-ext-enable redis
|
|
||||||
RUN pear install channel://pear.php.net/Net_IDNA2-0.1.1 Auth_SASL Net_IMAP NET_SMTP Net_IDNA2 Mail_mime
|
|
||||||
RUN apk del autoconf g++ make libxml2-dev icu-dev
|
|
||||||
|
|
||||||
COPY ./docker-entrypoint.sh /
|
# Add group + user - 82 is the standard uid/gid for "www-data" in Alpine
|
||||||
|
RUN set -x \
|
||||||
|
&& addgroup -g 82 -S www-data \
|
||||||
|
&& adduser -u 82 -D -S -G www-data www-data \
|
||||||
|
\
|
||||||
|
# Install Dependencies
|
||||||
|
&& apk add --update \
|
||||||
|
&& apk add --no-cache bash php7-fpm php7-intl php7-pdo php7-pdo_mysql php7-xmlrpc php7-redis php7-pear \
|
||||||
|
php7-pear-auth_sasl php7-pear-net_smtp php7-pear-net_idna2 php7-pear-mail_mime \
|
||||||
|
&& pear install Net_IMAP \
|
||||||
|
# MISSING apk for php7-pear-net_imap - can be installed once https://github.com/alpinelinux/aports/pull/1359 is merged.
|
||||||
|
\
|
||||||
|
# Configuring php-fpm
|
||||||
|
&& set -ex \
|
||||||
|
&& cd /etc/php7/ \
|
||||||
|
# Change the setting so the daemon runs in the foreground and as www-data:www-data
|
||||||
|
#&& sed -i 's/^;daemonize .*$/daemonize = no/g' /etc/php7/php-fpm.conf \
|
||||||
|
&& sed -i 's/^user = .*/user = www-data/' /etc/php7/php-fpm.d/www.conf \
|
||||||
|
&& sed -i 's/^group = .*/group = www-data/' /etc/php7/php-fpm.d/www.conf \
|
||||||
|
&& { \
|
||||||
|
echo '[global]'; \
|
||||||
|
echo 'error_log = /proc/self/fd/2'; \
|
||||||
|
echo; \
|
||||||
|
echo '[www]'; \
|
||||||
|
echo '; if we send this to /proc/self/fd/1, it never appears'; \
|
||||||
|
echo 'access.log = /proc/self/fd/2'; \
|
||||||
|
echo; \
|
||||||
|
echo 'clear_env = no'; \
|
||||||
|
echo; \
|
||||||
|
echo '; Ensure worker stdout and stderr are sent to the main error log.'; \
|
||||||
|
echo 'catch_workers_output = yes'; \
|
||||||
|
} | tee php-fpm.d/docker.conf \
|
||||||
|
&& { \
|
||||||
|
echo '[global]'; \
|
||||||
|
echo 'daemonize = no'; \
|
||||||
|
echo; \
|
||||||
|
echo '[www]'; \
|
||||||
|
echo 'listen = [::]:9000'; \
|
||||||
|
} | tee php-fpm.d/zz-docker.conf
|
||||||
|
|
||||||
EXPOSE 9000
|
EXPOSE 9000
|
||||||
|
|
||||||
|
# Time to milk the cows ;)
|
||||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||||
CMD ["php-fpm"]
|
CMD ["php-fpm7"]
|
||||||
|
Loading…
Reference in New Issue
Block a user