mirror of
https://github.com/docker/docs.git
synced 2026-03-27 06:18:55 +07:00
Updated to PHP 8.5 + small fixes and improvements.
This commit is contained in:
@@ -119,7 +119,7 @@ A workspace container provides a dedicated shell for asset compilation, Artisan/
|
||||
```dockerfile
|
||||
# docker/development/workspace/Dockerfile
|
||||
# Use the official PHP CLI image as the base
|
||||
FROM php:8.4-cli
|
||||
FROM php:8.5-cli
|
||||
|
||||
# Set environment variables for user and group ID
|
||||
ARG UID=1000
|
||||
@@ -141,13 +141,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
pdo_mysql \
|
||||
pdo_pgsql \
|
||||
pgsql \
|
||||
opcache \
|
||||
intl \
|
||||
zip \
|
||||
bcmath \
|
||||
soap \
|
||||
&& pecl install redis xdebug \
|
||||
&& docker-php-ext-enable redis xdebug\
|
||||
&& pecl install redis \
|
||||
&& docker-php-ext-enable redis \
|
||||
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
|
||||
&& apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
@@ -161,6 +160,7 @@ ARG XDEBUG_LOG_LEVEL
|
||||
|
||||
# Configure Xdebug if enabled
|
||||
RUN if [ "${XDEBUG_ENABLED}" = "true" ]; then \
|
||||
pecl install xdebug && \
|
||||
docker-php-ext-enable xdebug && \
|
||||
echo "xdebug.mode=${XDEBUG_MODE}" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
|
||||
echo "xdebug.idekey=${XDEBUG_IDE_KEY}" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
|
||||
|
||||
@@ -47,7 +47,7 @@ For production, the `php-fpm` Dockerfile creates an optimized image with only th
|
||||
|
||||
```dockerfile
|
||||
# Stage 1: Build environment and Composer dependencies
|
||||
FROM php:8.4-fpm AS builder
|
||||
FROM php:8.5-fpm AS builder
|
||||
|
||||
# Install system dependencies and PHP extensions for Laravel with MySQL/PostgreSQL support.
|
||||
# Dependencies in this stage are only required for building the final image.
|
||||
@@ -66,7 +66,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
pdo_mysql \
|
||||
pdo_pgsql \
|
||||
pgsql \
|
||||
opcache \
|
||||
intl \
|
||||
zip \
|
||||
bcmath \
|
||||
@@ -100,7 +99,7 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local
|
||||
&& composer install --no-dev --optimize-autoloader --no-interaction --no-progress --prefer-dist
|
||||
|
||||
# Stage 2: Production environment
|
||||
FROM php:8.4-fpm AS production
|
||||
FROM php:8.5-fpm AS production
|
||||
|
||||
# Install only runtime libraries needed in production
|
||||
# libfcgi-bin and procps are required for the php-fpm-healthcheck script
|
||||
@@ -175,7 +174,7 @@ If you need a separate CLI container with different extensions or strict separat
|
||||
|
||||
```dockerfile
|
||||
# Stage 1: Build environment and Composer dependencies
|
||||
FROM php:8.4-cli AS builder
|
||||
FROM php:8.5-cli AS builder
|
||||
|
||||
# Install system dependencies and PHP extensions required for Laravel + MySQL/PostgreSQL support
|
||||
# Some dependencies are required for PHP extensions only in the build stage
|
||||
@@ -193,7 +192,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
pdo_mysql \
|
||||
pdo_pgsql \
|
||||
pgsql \
|
||||
opcache \
|
||||
intl \
|
||||
zip \
|
||||
bcmath \
|
||||
@@ -213,7 +211,7 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local
|
||||
&& composer install --no-dev --optimize-autoloader --no-interaction --no-progress --prefer-dist
|
||||
|
||||
# Stage 2: Production environment
|
||||
FROM php:8.4-cli
|
||||
FROM php:8.5-cli
|
||||
|
||||
# Install client libraries required for php extensions in runtime
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
@@ -246,7 +244,7 @@ USER www-data
|
||||
CMD ["bash"]
|
||||
```
|
||||
|
||||
This Dockerfile is similar to the PHP-FPM Dockerfile, but it uses the `php:8.4-cli` image as the base image and sets up the container for running CLI commands.
|
||||
This Dockerfile is similar to the PHP-FPM Dockerfile, but it uses the `php:8.5-cli` image as the base image and sets up the container for running CLI commands.
|
||||
|
||||
## Create a Dockerfile for Nginx (production)
|
||||
|
||||
@@ -428,7 +426,7 @@ volumes:
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> Ensure you have an `.env` file at the root of your Laravel project with the necessary configurations (e.g., database and Xdebug settings) to match the Docker Compose setup.
|
||||
> Ensure you have an `.env` file at the root of your Laravel project with the necessary configurations to match the Docker Compose setup.
|
||||
|
||||
## Running your production environment
|
||||
|
||||
|
||||
Reference in New Issue
Block a user