Created
December 12, 2016 19:27
-
-
Save pvgomes/a16410fcc0a1f0440d13f40ec66a8c69 to your computer and use it in GitHub Desktop.
Dockerfile PHP 7 NGINX alpine linux
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
# Use Alpine Linux | |
FROM alpine:edge | |
# Timezone | |
ENV TIMEZONE America/Sao_Paulo | |
ENV PHP_MEMORY_LIMIT 512M | |
ENV MAX_UPLOAD 50M | |
ENV PHP_MAX_FILE_UPLOAD 200 | |
ENV PHP_MAX_POST 100M | |
ADD ./conf/nginx.runit /etc/service/nginx/run | |
ADD ./conf/php7.runit /etc/service/php7/run | |
RUN echo "@community http://nl.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \ | |
echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \ | |
apk update && \ | |
apk upgrade && \ | |
apk add --update tzdata && \ | |
cp /usr/share/zoneinfo/${TIMEZONE} /etc/localtime && \ | |
echo "${TIMEZONE}" > /etc/timezone && \ | |
apk add --update \ | |
runit@community=2.1.2-r3 \ | |
nginx \ | |
curl \ | |
git \ | |
openssh-client \ | |
php7@community=7.0.14-r2 \ | |
php7-dev@community=7.0.14-r2 \ | |
php7-opcache@community=7.0.14-r2 \ | |
php7-openssl@community=7.0.14-r2 \ | |
php7-phar@community=7.0.14-r2 \ | |
php7-mcrypt@community=7.0.14-r2 \ | |
php7-mbstring@community=7.0.14-r2 \ | |
php7-json@community=7.0.14-r2 \ | |
php7-common@community=7.0.14-r2 \ | |
php7-session@community=7.0.14-r2 \ | |
php7-ctype@community=7.0.14-r2 \ | |
php7-dom@community=7.0.14-r2 \ | |
php7-fpm@community=7.0.14-r2 \ | |
php7-bcmath@community=7.0.14-r2 \ | |
php7-mongodb@testing=1.1.4-r1 \ | |
php7-redis@testing=3.0.0-r1 \ | |
php7-amqp@testing=1.7.1-r0 \ | |
php7-xdebug@community=2.5.0-r1 && \ | |
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 && \ | |
echo "xdebug.remote_enable=1" >> /etc/php7/conf.d/xdebug.ini && \ | |
echo "xdebug.remote_handler=dbgp" >> /etc/php7/conf.d/xdebug.ini && \ | |
echo "xdebug.remote_mode=req" >> /etc/php7/conf.d/xdebug.ini && \ | |
echo "xdebug.remote_port=9001" >> /etc/php7/conf.d/xdebug.ini && \ | |
echo "xdebug.remote_autostart=1" >> /etc/php7/conf.d/xdebug.ini && \ | |
echo "xdebug.remote_connect_back=1" >> /etc/php7/conf.d/xdebug.ini && \ | |
echo "xdebug.remote_host="`/sbin/ip route|awk '/default/ { print $6 }'` >> /etc/php7/conf.d/xdebug.ini && \ | |
ln -sf /usr/bin/php7 /usr/bin/php && \ | |
curl --insecure -sS https://getcomposer.org/installer | php && \ | |
mv composer.phar /usr/bin/composer && \ | |
mkdir /etc/nginx/sites-enabled && \ | |
adduser -u 1000 docker -D -s /bin/ash && \ | |
chown -R docker:docker /home/docker && \ | |
mkdir -p /etc/service && \ | |
chmod a+x /etc/service/nginx/run && \ | |
chmod a+x /etc/service/php7/run && \ | |
mkdir /www && \ | |
chown -R docker:docker /www && \ | |
apk del tzdata && \ | |
rm -fr /tmp/*.apk && \ | |
rm -rf /var/cache/apk/* | |
RUN rm /etc/nginx/conf.d/default.conf | |
ADD /conf/nginx.conf /etc/nginx/nginx.conf | |
ADD /conf/default.conf /etc/nginx/sites-enabled/default | |
ADD /conf/php-fpm.conf /etc/php7/php-fpm.conf | |
ADD ./conf/www.conf /etc/php7/php-fpm.d/www.conf | |
# Set Workdir | |
WORKDIR /www | |
# Expose ports | |
EXPOSE 80 443 | |
CMD ["sh", "-c", "exec /sbin/runsvdir -P /etc/service/"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment