FROM alpine:3.8

# Environments
ENV TIMEZONE Europe/Moscow
ENV PHP_MEMORY_LIMIT 1024M
ENV MAX_UPLOAD 128M
ENV PHP_MAX_FILE_UPLOAD 128
ENV PHP_MAX_POST 128M
ENV PHPUSER 1000

RUN apk update && \ 
apk upgrade && \ 
apk add pdftk \
php7 php7-fpm php7-opcache php7-pdo php7-pdo_mysql php7-json php7-mbstring && \
rm -rf /var/cache/apk/* && \
#add localuser
addgroup -g ${PHPUSER} -S www-data && \
adduser -u ${PHPUSER} -D -S -G www-data www-data  && \
#localuser
sed -i -e "s/user\s*=\s*nobody/user = www-data/g" /etc/php7/php-fpm.d/www.conf && \
sed -i -e "s/group\s*=\s*nobody/group = www-data/g" /etc/php7/php-fpm.d/www.conf && \
#connect
sed -i "s|;*listen\s*=\s*127.0.0.1:9000|listen = 9000|g" /etc/php7/php-fpm.d/www.conf && \
sed -i "s|;*listen\s*=\s*/||g" /etc/php7/php-fpm.d/www.conf && \
#vars
sed -i 's/short_open_tag = Off/short_open_tag = On/g' /etc/php7/php.ini  && \
sed -i "s|;*date.timezone =.*|date.timezone = ${TIMEZONE}|i" /etc/php7/php.ini && \
sed -i "s|;*memory_limit =.*|memory_limit = ${PHP_MEMORY_LIMIT}|i" /etc/php7/php.ini


EXPOSE 9000

WORKDIR /vhosts

CMD ["php-fpm7", "-F"]



