| ARG VERSION=8.0.8-fpm-buster-nginx-1.21.1 |
| FROM dwchiang/nginx-php-fpm:8.0.8-fpm-buster-nginx-1.21.1 |
|
|
| ARG VERSION_PHP_MINOR |
| ARG VERSION_OS |
| ENV VERSION_OS=${VERSION_OS} |
|
|
| |
| |
| |
|
|
| RUN set -x && \ |
| |
| apt-get update --allow-releaseinfo-change &&\ |
| apt-get install --no-install-recommends --no-install-suggests -y \ |
| bc \ |
| |
| |
| libbz2-dev \ |
| |
| |
| libfreetype6-dev \ |
| libpng-dev \ |
| libjpeg62-turbo-dev \ |
| && \ |
| |
| apt-get install --no-install-recommends --no-install-suggests -y \ |
| |
| git \ |
| && \ |
| |
| |
| |
| |
| |
| if [ $(echo "${VERSION_PHP_MINOR} >= 7.4" | bc) -eq 1 ]; then \ |
| docker-php-ext-configure gd --with-freetype --with-jpeg ; \ |
| else \ |
| docker-php-ext-configure gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-png-dir=/usr ; \ |
| fi && \ |
| docker-php-ext-install -j$(nproc) \ |
| bcmath \ |
| mysqli \ |
| pdo \ |
| pdo_mysql \ |
| bz2 \ |
| gd \ |
| exif \ |
| opcache \ |
| && \ |
| docker-php-source delete && \ |
| |
| mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" && \ |
| |
| |
| echo "memory_limit=2048M" > $PHP_INI_DIR/conf.d/memory-limit.ini && \ |
| echo "max_execution_time=900" >> $PHP_INI_DIR/conf.d/memory-limit.ini && \ |
| echo "post_max_size=20M" >> $PHP_INI_DIR/conf.d/memory-limit.ini && \ |
| echo "upload_max_filesize=20M" >> $PHP_INI_DIR/conf.d/memory-limit.ini && \ |
| |
| echo "date.timezone=${PHP_TIMEZONE:-UTC}" > $PHP_INI_DIR/conf.d/date_timezone.ini && \ |
| |
| echo "display_errors=stderr" > $PHP_INI_DIR/conf.d/display-errors.ini && \ |
| |
| echo "cgi.fix_pathinfo=0" > $PHP_INI_DIR/conf.d/path-info.ini && \ |
| |
| echo "expose_php=0" > $PHP_INI_DIR/conf.d/path-info.ini && \ |
| |
| curl -sS https://getcomposer.org/installer | php -- --quiet --install-dir=/usr/local/bin --filename=composer && \ |
| |
| rm -rf /var/lib/apt/lists/* && \ |
| rm -rf /usr/share/nginx/html/* |
| |
| |
| |
| |
| |
| COPY public /usr/share/nginx/html |
| COPY . /var/www/html |
| |
| RUN mkdir /docker-entrypoint.d |
| RUN mkdir -p /var/log/supervisor |
| |
| RUN set -x && \ |
| |
| |
| |
| |
| if [ -f "/var/www/html/composer.lock" ]; then \ |
| if [ "${APP_ENV}" == "development" ] || [ "${APP_ENV}" == "dev" || "${APP_ENV}" == "staging" ] || [ "${APP_ENV}" == "stage" ]; then \ |
| composer install --working-dir=/var/www/html ; \ |
| else \ |
| composer install --no-dev --working-dir=/var/www/html ; \ |
| fi \ |
| fi && \ |
| |
| touch /var/www/html/storage/logs/laravel.log && \ |
| touch /var/log/cron.log && \ |
| |
| |
| php artisan key:generate && \ |
| chown -R www-data:www-data /usr/share/nginx/html && \ |
| chown -R www-data:www-data /var/www/html && \ |
| find /var/www/html/storage -type f -exec chmod 664 {} \; && \ |
| find /var/www/html/storage -type d -exec chmod 770 {} \; |
| |
| |
| |
| |
| COPY scripts/docker-entrypoint.sh / |
| COPY scripts/10-listen-on-ipv6-by-default.sh /docker-entrypoint.d |
| COPY scripts/20-envsubst-on-templates.sh /docker-entrypoint.d |
| COPY scripts/30-tune-worker-processes.sh /docker-entrypoint.d |
| |
| COPY conf/nginx/nginx-site.conf /etc/nginx/nginx.conf |
| COPY conf/nginx/nginx-site.conf /etc/nginx/conf.d/default.conf |
| |
| USER root |
| RUN mkdir -p -m 0700 /root/.ssh |
| |
| RUN chmod -R 777 /var/run |
| |
| EXPOSE 7860 |
| |
| CMD ["/docker-entrypoint.sh"] |
| |