Last active
May 19, 2021 12:40
-
-
Save phith0n/373cc078a8b25a20432408d5d7556770 to your computer and use it in GitHub Desktop.
分享自己用的两份Alpine-php-fpm的dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:3.3 | |
MAINTAINER Didiet Noor <[email protected]> (@lynxluna) | |
# Patch APK Mirror to YKode | |
RUN echo "http://dl-4.alpinelinux.org/alpine/v3.3/main" > /etc/apk/repositories | |
ENV TIMEZONE Asia/Shanghai | |
ENV PHP_MEMORY_LIMIT 512M | |
ENV MAX_UPLOAD 50M | |
ENV PHP_MAX_FILE_UPLOAD 200 | |
ENV PHP_MAX_POST 100M | |
RUN apk update && \ | |
apk add tzdata && \ | |
cp /usr/share/zoneinfo/${TIMEZONE} /etc/localtime && \ | |
echo "${TIMEZONE}" > /etc/timezone && \ | |
apk add php-intl \ | |
php-mcrypt \ | |
php-openssl \ | |
php-gmp \ | |
php-json \ | |
php-dom \ | |
php-pdo \ | |
php-zip \ | |
php-zlib \ | |
php-mysqli \ | |
php-bcmath \ | |
php-gd \ | |
php-xcache \ | |
php-pdo_mysql \ | |
php-gettext \ | |
php-xmlreader \ | |
php-xmlrpc \ | |
php-bz2 \ | |
php-memcache \ | |
php-iconv \ | |
php-curl \ | |
php-ctype \ | |
php-fpm \ | |
php-phar \ | |
php && \ | |
curl -sS https://getcomposer.org/installer | \ | |
php -- --install-dir=/usr/bin --filename=composer && \ | |
sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php/php-fpm.conf && \ | |
sed -i -e "s/listen\s*=\s*127.0.0.1:9000/listen = 9000/g" /etc/php/php-fpm.conf && \ | |
sed -i "s|;date.timezone =.*|date.timezone = ${TIMEZONE}|" /etc/php/php.ini && \ | |
sed -i "s|memory_limit =.*|memory_limit = ${PHP_MEMORY_LIMIT}|" /etc/php/php.ini && \ | |
sed -i "s|upload_max_filesize =.*|upload_max_filesize = ${MAX_UPLOAD}|" /etc/php/php.ini && \ | |
sed -i "s|max_file_uploads =.*|max_file_uploads = ${PHP_MAX_FILE_UPLOAD}|" /etc/php/php.ini && \ | |
sed -i "s|post_max_size =.*|max_file_uploads = ${PHP_MAX_POST}|" /etc/php/php.ini && \ | |
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/php.ini && \ | |
mkdir /www && \ | |
apk del tzdata && \ | |
rm -rf /var/cache/apk/* | |
WORKDIR /www | |
VOLUME ["/www"] | |
EXPOSE 9000 | |
CMD ["php-fpm"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:edge | |
MAINTAINER phithon <[email protected]> | |
ENV TIMEZONE Asia/Shanghai | |
ENV PHP_MEMORY_LIMIT 512M | |
ENV MAX_UPLOAD 50M | |
ENV PHP_MAX_FILE_UPLOAD 200 | |
ENV PHP_MAX_POST 100M | |
RUN apk update && \ | |
apk add tzdata curl && \ | |
cp /usr/share/zoneinfo/${TIMEZONE} /etc/localtime && \ | |
echo "${TIMEZONE}" > /etc/timezone && \ | |
apk --update --repository=http://dl-4.alpinelinux.org/alpine/edge/testing add \ | |
php7 \ | |
php7-common \ | |
php7-intl \ | |
php7-gd \ | |
php7-mcrypt \ | |
php7-openssl \ | |
php7-gmp \ | |
php7-json \ | |
php7-dom \ | |
php7-pdo \ | |
php7-zip \ | |
php7-zlib \ | |
php7-mysqli \ | |
php7-bcmath \ | |
php7-pdo_mysql \ | |
php7-gettext \ | |
php7-xmlreader \ | |
php7-xmlrpc \ | |
php7-bz2 \ | |
php7-iconv \ | |
php7-curl \ | |
php7-ctype \ | |
php7-fpm \ | |
php7-mbstring \ | |
php7-session \ | |
php7-phar && \ | |
curl -sS https://getcomposer.org/installer | \ | |
php7 -- --install-dir=/usr/bin --filename=composer && \ | |
sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php7/php-fpm.conf && \ | |
sed -i -e "s/listen\s*=\s*127.0.0.1:9000/listen = 9000/g" /etc/php7/php-fpm.d/www.conf && \ | |
sed -i "s|;date.timezone =.*|date.timezone = ${TIMEZONE}|" /etc/php7/php.ini && \ | |
sed -i "s|memory_limit =.*|memory_limit = ${PHP_MEMORY_LIMIT}|" /etc/php7/php.ini && \ | |
sed -i "s|upload_max_filesize =.*|upload_max_filesize = ${MAX_UPLOAD}|" /etc/php7/php.ini && \ | |
sed -i "s|max_file_uploads =.*|max_file_uploads = ${PHP_MAX_FILE_UPLOAD}|" /etc/php7/php.ini && \ | |
sed -i "s|post_max_size =.*|max_file_uploads = ${PHP_MAX_POST}|" /etc/php7/php.ini && \ | |
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php7/php.ini && \ | |
ln -s /usr/bin/php7 /usr/bin/php && \ | |
mkdir /www && \ | |
apk del tzdata curl && \ | |
rm -rf /var/cache/apk/* | |
WORKDIR /www | |
VOLUME ["/www"] | |
EXPOSE 9000 | |
CMD ["php-fpm7"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
这个php7的会报错