-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
16 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,48 @@ | ||
FROM php:8.3-fpm | ||
|
||
RUN apt-get update && apt-get install --no-install-recommends --no-install-suggests -y \ | ||
# Install necessary dependencies and PHP extensions | ||
RUN apt-get update && apt-get install --no-install-recommends --no-install-suggests -y \ | ||
libpng-dev \ | ||
libxml2-dev \ | ||
libldap2-dev \ | ||
libldb-dev \ | ||
libzip-dev \ | ||
unzip \ | ||
git \ | ||
openssl \ | ||
ca-certificates \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/libldap.so \ | ||
&& ln -s /usr/lib/x86_64-linux-gnu/liblber.so /usr/lib/liblber.so \ | ||
&& docker-php-ext-install -j$(nproc) xml gd ldap mysqli pdo_mysql zip \ | ||
&& pecl install timezonedb xdebug\ | ||
&& docker-php-ext-enable timezonedb xdebug | ||
&& pecl install timezonedb xdebug \ | ||
&& docker-php-ext-enable timezonedb xdebug \ | ||
&& update-ca-certificates # Ensure OpenSSL CA certificates are updated | ||
|
||
# Copy Composer from the Composer official image | ||
COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer | ||
|
||
# Copy PHP configuration | ||
COPY docker/php.ini /usr/local/etc/php/ | ||
|
||
# Copy the application code | ||
COPY . /var/www/html | ||
|
||
# Copy custom entrypoint script for PHP-FPM | ||
COPY docker/docker-entrypoint-php-fpm.sh / | ||
|
||
# Install PHP dependencies using Composer and set correct permissions | ||
RUN cd /var/www/html \ | ||
&& composer install --no-ansi --no-dev --no-interaction --no-plugins --no-progress --optimize-autoloader \ | ||
&& mkdir -p /var/www/html/app/tmp/cache/persistent /var/www/html/app/tmp/cache/models /var/www/html/app/tmp/logs \ | ||
&& chown www-data:www-data -R /var/www/html/app/tmp/cache \ | ||
&& chown www-data:www-data -R /var/www/html/app/tmp/logs | ||
|
||
# Customize PHP-FPM configuration | ||
RUN set -ex \ | ||
## Customize PHP fpm configuration | ||
&& sed -i -e "s/;clear_env\s*=\s*no/clear_env = no/g" /usr/local/etc/php-fpm.conf \ | ||
&& sed -i -e "s/;request_terminate_timeout\s*=[^\n]*/request_terminate_timeout = 300/g" /usr/local/etc/php-fpm.conf \ | ||
&& php-fpm --test | ||
|
||
# Set the entrypoint for PHP-FPM | ||
CMD ["/docker-entrypoint-php-fpm.sh"] |