dimti
2 years ago
1 changed files with 140 additions and 0 deletions
@ -0,0 +1,140 @@ |
|||
RUN apt-get update && apt-get install -y \ |
|||
libfreetype6-dev \ |
|||
libjpeg62-turbo-dev \ |
|||
libpng-dev \ |
|||
libwebp-dev \ |
|||
&& docker-php-ext-install -j$(nproc) iconv \ |
|||
&& docker-php-ext-install mysqli \ |
|||
&& docker-php-ext-enable mysqli |
|||
|
|||
RUN apt-get update && docker-php-ext-install pdo pdo_mysql \ |
|||
&& docker-php-ext-enable pdo pdo_mysql |
|||
|
|||
########################################################################### |
|||
# xDebug: |
|||
########################################################################### |
|||
|
|||
# Copy xdebug configuration for remote debugging |
|||
COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini |
|||
|
|||
ARG INSTALL_XDEBUG=false |
|||
|
|||
RUN if [ ${INSTALL_XDEBUG} = true ]; then \ |
|||
# Install the xdebug extension |
|||
if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ |
|||
pecl install xdebug-2.5.5; \ |
|||
else \ |
|||
pecl install xdebug-2.9.8; \ |
|||
fi && \ |
|||
docker-php-ext-enable xdebug && \ |
|||
sed -i 's/^zend_extension=/;zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ |
|||
;fi |
|||
|
|||
########################################################################### |
|||
# Zip: |
|||
########################################################################### |
|||
|
|||
ARG INSTALL_ZIP=false |
|||
|
|||
RUN if [ ${INSTALL_ZIP} = true ]; then \ |
|||
apt update && apt install -y libzip-dev \ |
|||
&& docker-php-ext-install zip \ |
|||
&& docker-php-ext-enable zip \ |
|||
;fi |
|||
|
|||
########################################################################### |
|||
# BZ2: |
|||
########################################################################### |
|||
|
|||
ARG INSTALL_BZ2=false |
|||
|
|||
RUN if [ ${INSTALL_BZ2} = true ]; then \ |
|||
apt update && apt install -y libbz2-ocaml-dev \ |
|||
&& docker-php-ext-install bz2 \ |
|||
&& docker-php-ext-enable bz2 \ |
|||
;fi |
|||
|
|||
########################################################################### |
|||
# OPCACHE: |
|||
########################################################################### |
|||
|
|||
ARG INSTALL_OPCACHE=false |
|||
|
|||
RUN if [ ${INSTALL_OPCACHE} = true ]; then \ |
|||
docker-php-ext-install opcache \ |
|||
&& docker-php-ext-enable opcache \ |
|||
;fi |
|||
|
|||
########################################################################### |
|||
# INTL: |
|||
########################################################################### |
|||
|
|||
ARG INSTALL_INTL=false |
|||
|
|||
RUN if [ ${INSTALL_INTL} = true ]; then \ |
|||
apt update && apt install -y libicu-dev \ |
|||
&& docker-php-ext-install intl \ |
|||
&& docker-php-ext-enable intl \ |
|||
;fi |
|||
|
|||
########################################################################### |
|||
# PGSQL: |
|||
########################################################################### |
|||
|
|||
ARG INSTALL_PGSQL=false |
|||
|
|||
RUN if [ ${INSTALL_PGSQL} = true ]; then \ |
|||
apt update && apt install -y libpq-dev \ |
|||
&& docker-php-ext-install pgsql \ |
|||
&& docker-php-ext-install pdo_pgsql \ |
|||
;fi |
|||
|
|||
########################################################################### |
|||
# BCMATH: |
|||
########################################################################### |
|||
|
|||
ARG INSTALL_BCMATH=false |
|||
|
|||
RUN if [ ${INSTALL_BCMATH} = true ]; then \ |
|||
docker-php-ext-install bcmath \ |
|||
;fi |
|||
|
|||
########################################################################### |
|||
# Locales: |
|||
########################################################################### |
|||
|
|||
RUN apt --allow-releaseinfo-change update && \ |
|||
apt install -y locales && \ |
|||
sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ |
|||
sed -i 's/# ru_RU.UTF-8 UTF-8/ru_RU.UTF-8 UTF-8/' /etc/locale.gen && \ |
|||
locale-gen |
|||
|
|||
########################################################################### |
|||
# Prepend nginx 502 on showing errors: |
|||
# @see https://stackoverflow.com/questions/55260221/laravel-php-7-3-nginx-502-upstream-prematurely-closed-fastcgi-stdout |
|||
########################################################################### |
|||
|
|||
RUN sed -i "s/^log_limit = .*/log_limit = 1024/g" "$PHP_INI_DIR/../php-fpm.d/docker.conf" |
|||
|
|||
########################################################################### |
|||
# php.ini opts: |
|||
########################################################################### |
|||
|
|||
# https://github.com/php/php-src/blob/master/php.ini-development |
|||
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" |
|||
|
|||
########################################################################### |
|||
# Tune opts: |
|||
########################################################################### |
|||
|
|||
ARG PHP_OPT_MAX_EXECUTION_TIME=600 |
|||
RUN sed -i "s/^max_execution_time = .*/max_execution_time = $PHP_OPT_MAX_EXECUTION_TIME/g" "$PHP_INI_DIR/php.ini" |
|||
|
|||
ARG PHP_OPT_MEMORY_LIMIT=256M |
|||
RUN sed -i "s/^memory_limit = .*/memory_limit = $PHP_OPT_MEMORY_LIMIT/g" "$PHP_INI_DIR/php.ini" |
|||
|
|||
ARG PHP_OPT_POST_MAX_SIZE=48M |
|||
RUN sed -i "s/^post_max_size = .*/post_max_size = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini" |
|||
|
|||
ARG PHP_OPT_UPLOAD_MAX_FILESIZE=16M |
|||
RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini" |
Write
Preview
Loading…
Cancel
Save
Reference in new issue