Last active
November 15, 2023 07:16
-
-
Save littlefuntik/5b3e5b8732a36758b412087e1f76b337 to your computer and use it in GitHub Desktop.
Revisions
-
littlefuntik revised this gist
Jan 31, 2017 . 1 changed file with 20 additions and 17 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,9 @@ ## Container console commands (Windows: PowerShell) # docker build --no-cache -t php:7.1 # docker run --name test-php -v "${PWD}:/var/www:rw" -p "9001:9000" -d php:7.1 # docker exec -ti php:7.1 /bin/sh # docker rm test-php --force # docker rmi php:7.1 FROM alpine RUN \ @@ -49,33 +50,34 @@ cp php.ini-development /usr/local/etc/php/php.ini && \ pear config-set php_ini $PHP_INI_DIR/php.ini && \ pecl config-set php_ini $PHP_INI_DIR/php.ini && \ apk add geoip-dev && pecl install geoip-1.1.1 xdebug && \ { \ echo '[global]'; \ echo 'pid = /run/php-fpm.pid'; \ echo 'error_log = /proc/self/fd/2'; \ echo 'daemonize = no'; \ echo 'include=/usr/local/etc/php-fpm.d/*.conf'; \ } | tee /usr/local/etc/php-fpm.conf && \ { \ echo '[www]'; \ echo '; if we send this to /proc/self/fd/1, it never appears'; \ echo 'listen = 9000'; \ echo 'user = www-data'; \ echo 'group = www-data'; \ echo 'chdir = /var/www'; \ echo 'pm = dynamic'; \ echo 'pm.max_children = 9'; \ echo 'pm.start_servers = 3'; \ echo 'pm.max_spare_servers = 4'; \ echo 'pm.min_spare_servers = 2'; \ echo 'pm.max_requests = 20'; \ echo 'request_terminate_timeout = 0'; \ echo 'request_slowlog_timeout = 1s'; \ echo 'slowlog = /proc/self/fd/2'; \ echo 'catch_workers_output = yes'; \ echo 'access.log = /proc/self/fd/2'; \ echo 'clear_env = no'; \ echo 'php_flag[display_errors] = on'; \ echo 'php_admin_value[memory_limit] = 32M'; \ } | tee /usr/local/etc/php-fpm.d/docker.conf && \ sed -i \ -e "s|upload_max_filesize\s*=.*|upload_max_filesize = 100M|" \ @@ -86,7 +88,8 @@ sed -i \ /usr/local/etc/php/php.ini && \ mkdir /var/www && \ rm -rf /var/cache/apk/* && \ php -m && \ php -v WORKDIR /var/www -
littlefuntik created this gist
Jan 31, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,95 @@ ## Container console commands (Windows: PowerShell) # docker build --no-cache -t test-php:7.1 # docker run --name test-php -v "${PWD}:/var/www:rw" -w "/var/www" -p "9001:9000" -d test-php:7.1 # docker rm test-php --force # docker rmi test-php:7.1 FROM alpine RUN \ addgroup -g 82 -S www-data && adduser -u 82 -D -S -G www-data www-data && \ apk update && \ apk add tzdata && \ cp /usr/share/zoneinfo/Europe/Kiev /etc/localtime && \ echo "Europe/Kiev" > /etc/timezone && \ apk del tzdata && \ apk add ca-certificates && \ update-ca-certificates && \ apk add autoconf file g++ gcc libc-dev make pkgconf re2c openssl curl-dev libmcrypt-dev libxml2-dev libpng-dev libjpeg-turbo-dev && \ export PHP_INI_DIR="/usr/local/etc/php" && \ mkdir -p $PHP_INI_DIR/conf.d \ cd ~ && \ wget -O php-7.1.1.tar.gz http://ua2.php.net/get/php-7.1.1.tar.gz/from/this/mirror && \ tar -zxvf php-7.1.1.tar.gz && \ cd php-7.1.1 && \ export CFLAGS="-fstack-protector-strong -fpic -fpie -O2" && \ export CPPFLAGS="-fstack-protector-strong -fpic -fpie -O2" && \ export LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" && \ ./configure \ --prefix=/usr/local \ --with-config-file-path="$PHP_INI_DIR" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data \ --enable-debug \ --disable-short-tags \ --disable-ipv6 \ --disable-all \ --enable-libxml --enable-xml --enable-soap \ --with-curl \ --enable-mbstring \ --with-mcrypt \ --enable-pcntl \ --enable-zip \ --enable-mysqlnd --enable-pdo --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd \ --with-gd \ --with-pear && \ make -j "$(getconf _NPROCESSORS_ONLN)" && \ make install && \ make clean && \ cp php.ini-development /usr/local/etc/php/php.ini && \ pear config-set php_ini $PHP_INI_DIR/php.ini && \ pecl config-set php_ini $PHP_INI_DIR/php.ini && \ apk add geoip-dev && pecl install geoip-1.1.1 xdebug && \ cp /usr/local/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf && \ sed -i \ -e "s|;daemonize\s*=.*|daemonize = no|" \ -e "s|listen\s*=.*|listen = 9000|" \ /usr/local/etc/php-fpm.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 'chdir = /var/www'; \ echo 'access.log = /proc/self/fd/2'; \ echo 'listen = 9000'; \ echo 'user = www-data'; \ echo 'group = www-data'; \ echo 'pm = dynamic'; \ echo 'pm.max_children = 9'; \ echo 'pm.max_spare_servers = 4'; \ echo 'pm.min_spare_servers = 2'; \ echo 'pm.start_servers = 3'; \ echo 'request_terminate_timeout = 0'; \ 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 /usr/local/etc/php-fpm.d/docker.conf && \ sed -i \ -e "s|upload_max_filesize\s*=.*|upload_max_filesize = 100M|" \ -e "s|max_file_uploads\s*=.*|max_file_uploads = 50|" \ -e "s|post_max_size\s*=.*|post_max_size = 100M|" \ -e "s|;cgi.fix_pathinfo\s*=.*|cgi.fix_pathinfo = 1|" \ -e "s|;date.timezone\s*=.*|date.timezone = Europe/Kiev|" \ /usr/local/etc/php/php.ini && \ mkdir /var/www && \ rm -rf /var/cache/apk/* && \ php -m && php -v WORKDIR /var/www EXPOSE 9000 CMD ["php-fpm"]