-
-
Save phith0n/373cc078a8b25a20432408d5d7556770 to your computer and use it in GitHub Desktop.
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"] |
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"] |
代码是不是直接复制进去比较好?
如果代码会经常修改,直接复制进去就不方便了。另外容器也会经常更新,比如php7出下个稳定版本(修复漏洞),我就需要重新编译镜像,并重新启动容器。如果代码在外面的话,我可以直接删除老容器启动新容器,无需额外迁移操作。
请问,php5的,怎么加上redis扩展?
[3/5] RUN mkdir -p /run/nginx && chown -R nobody.nobody /run 0.5s => ERROR [4/5] RUN apk update && apk add --no-cache curl tzdata && cp /usr/share/zoneinfo/Asia/S 5.2s ------
[4/5] RUN apk update && apk add --no-cache curl tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /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-redis php7-session php7-phar &&
curl -sS https://getcomposer.org/installer | php7 -- --install-dir=/usr/bin --filename=composer &&
composer self-update && sed -i -e "s/;daemonize\s*=\syes/daemonize = no/g" /etc/php7/php-fpm.conf &&
sed -i -e "s/listen\s=\s127.0.0.1:9000/listen = 9000/g" /etc/php7/php-fpm.d/www.conf && sed -i "s|;date.timezone =.|date.timezone = Asia/Shanghai|" /etc/php7/php.ini && sed -i "s|memory_limit =.|memory_limit = 512M|" /etc/php7/php.ini && sed -i "s|upload_max_filesize =.|upload_max_filesize = 50M|" /etc/php7/php.ini && sed -i "s|max_file_uploads =.|max_file_uploads = 200|" /etc/php7/php.ini && sed -i "s|post_max_size =.|max_file_uploads = 100M|" /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/*:
#7 0.485 fetch https://mirrors.cloud.tencent.com/alpine/latest-stable/main/x86_64/APKINDEX.tar.gz
#7 0.734 v3.13.5-117-gda91dd0801 [https://mirrors.cloud.tencent.com/alpine/latest-stable/main/]
#7 0.734 OK: 4717 distinct packages available
#7 0.746 fetch https://mirrors.cloud.tencent.com/alpine/latest-stable/main/x86_64/APKINDEX.tar.gz
#7 0.899 (1/1) Installing tzdata (2021a-r0)
#7 1.556 Executing busybox-1.31.1-r9.trigger
#7 1.612 OK: 15 MiB in 28 packages
#7 1.630 fetch http://dl-4.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz
#7 5.090 ERROR: unsatisfiable constraints:
#7 5.091 php7 (missing):
#7 5.091 required by: world[php7]
#7 5.091 php7-bcmath (missing):
#7 5.091 required by: world[php7-bcmath]
#7 5.091 php7-bz2 (missing):
#7 5.091 required by: world[php7-bz2]
#7 5.091 php7-common (missing):
#7 5.091 required by: world[php7-common]
#7 5.091 php7-ctype (missing):
#7 5.091 required by: world[php7-ctype]
#7 5.091 php7-curl (missing):
#7 5.091 required by: world[php7-curl]
#7 5.091 php7-dom (missing):
#7 5.091 required by: world[php7-dom]
#7 5.091 php7-fpm (missing):
#7 5.091 required by: world[php7-fpm]
#7 5.091 php7-gd (missing):
#7 5.091 required by: world[php7-gd]
#7 5.091 php7-gettext (missing):
#7 5.091 required by: world[php7-gettext]
#7 5.091 php7-gmp (missing):
#7 5.091 required by: world[php7-gmp]
#7 5.091 php7-iconv (missing):
#7 5.091 required by: world[php7-iconv]
#7 5.091 php7-intl (missing):
#7 5.091 required by: world[php7-intl]
#7 5.091 php7-json (missing):
#7 5.091 required by: world[php7-json]
#7 5.091 php7-mbstring (missing):
#7 5.091 required by: world[php7-mbstring]
#7 5.091 php7-mcrypt (missing):
#7 5.091 required by: world[php7-mcrypt]
#7 5.091 php7-mysqli (missing):
#7 5.091 required by: world[php7-mysqli]
这个php7的会报错
编译好大小仅有70M左右。
https://www.leavesongs.com 的配置,链接到mariadb