Skip to content

Commit b08475e

Browse files
authored
Merge pull request #24187 from rw4lll/laravel-compose-update-2026-02
Laravel framework guide update
2 parents 754f6be + 9230f1b commit b08475e

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

content/guides/frameworks/laravel/development-setup.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ A workspace container provides a dedicated shell for asset compilation, Artisan/
119119
```dockerfile
120120
# docker/development/workspace/Dockerfile
121121
# Use the official PHP CLI image as the base
122-
FROM php:8.4-cli
122+
FROM php:8.5-cli
123123

124124
# Set environment variables for user and group ID
125125
ARG UID=1000
@@ -141,13 +141,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
141141
pdo_mysql \
142142
pdo_pgsql \
143143
pgsql \
144-
opcache \
145144
intl \
146145
zip \
147146
bcmath \
148147
soap \
149-
&& pecl install redis xdebug \
150-
&& docker-php-ext-enable redis xdebug\
148+
&& pecl install redis \
149+
&& docker-php-ext-enable redis \
151150
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
152151
&& apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
153152

@@ -161,6 +160,7 @@ ARG XDEBUG_LOG_LEVEL
161160

162161
# Configure Xdebug if enabled
163162
RUN if [ "${XDEBUG_ENABLED}" = "true" ]; then \
163+
pecl install xdebug && \
164164
docker-php-ext-enable xdebug && \
165165
echo "xdebug.mode=${XDEBUG_MODE}" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
166166
echo "xdebug.idekey=${XDEBUG_IDE_KEY}" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \

content/guides/frameworks/laravel/production-setup.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ my-laravel-app/
2121
├── docker/
2222
│ ├── common/
2323
│ │ └── php-fpm/
24-
│ │ └── Dockerfile
24+
│ │ ├── Dockerfile
25+
│ │ └── conf.d/
26+
│ │ └── 20-status-path.conf
2527
│ ├── development/
2628
│ ├── production/
2729
│ │ ├── php-fpm/
@@ -45,7 +47,7 @@ For production, the `php-fpm` Dockerfile creates an optimized image with only th
4547

4648
```dockerfile
4749
# Stage 1: Build environment and Composer dependencies
48-
FROM php:8.4-fpm AS builder
50+
FROM php:8.5-fpm AS builder
4951

5052
# Install system dependencies and PHP extensions for Laravel with MySQL/PostgreSQL support.
5153
# Dependencies in this stage are only required for building the final image.
@@ -64,7 +66,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
6466
pdo_mysql \
6567
pdo_pgsql \
6668
pgsql \
67-
opcache \
6869
intl \
6970
zip \
7071
bcmath \
@@ -98,7 +99,7 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local
9899
&& composer install --no-dev --optimize-autoloader --no-interaction --no-progress --prefer-dist
99100

100101
# Stage 2: Production environment
101-
FROM php:8.4-fpm AS production
102+
FROM php:8.5-fpm AS production
102103

103104
# Install only runtime libraries needed in production
104105
# libfcgi-bin and procps are required for the php-fpm-healthcheck script
@@ -136,8 +137,8 @@ COPY --from=builder /usr/local/bin/docker-php-ext-* /usr/local/bin/
136137
# -----------------------------------------------------------
137138
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
138139

139-
# Enable PHP-FPM status page by modifying zz-docker.conf with sed
140-
RUN sed -i '/\[www\]/a pm.status_path = /status' /usr/local/etc/php-fpm.d/zz-docker.conf
140+
# Keep the image-provided FPM global config intact and add pool overrides separately
141+
COPY ./docker/common/php-fpm/conf.d/*.conf /usr/local/etc/php-fpm.d/
141142
# Update the variables_order to include E (for ENV)
142143
#RUN sed -i 's/variables_order = "GPCS"/variables_order = "EGPCS"/' "$PHP_INI_DIR/php.ini"
143144

@@ -173,7 +174,7 @@ If you need a separate CLI container with different extensions or strict separat
173174

174175
```dockerfile
175176
# Stage 1: Build environment and Composer dependencies
176-
FROM php:8.4-cli AS builder
177+
FROM php:8.5-cli AS builder
177178

178179
# Install system dependencies and PHP extensions required for Laravel + MySQL/PostgreSQL support
179180
# Some dependencies are required for PHP extensions only in the build stage
@@ -191,7 +192,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
191192
pdo_mysql \
192193
pdo_pgsql \
193194
pgsql \
194-
opcache \
195195
intl \
196196
zip \
197197
bcmath \
@@ -211,7 +211,7 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local
211211
&& composer install --no-dev --optimize-autoloader --no-interaction --no-progress --prefer-dist
212212

213213
# Stage 2: Production environment
214-
FROM php:8.4-cli
214+
FROM php:8.5-cli
215215

216216
# Install client libraries required for php extensions in runtime
217217
RUN apt-get update && apt-get install -y --no-install-recommends \
@@ -244,7 +244,7 @@ USER www-data
244244
CMD ["bash"]
245245
```
246246

247-
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.
247+
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.
248248

249249
## Create a Dockerfile for Nginx (production)
250250

@@ -368,7 +368,7 @@ services:
368368
env_file:
369369
- .env
370370
networks:
371-
- laravel
371+
- laravel-production
372372

373373
postgres:
374374
image: postgres:18
@@ -426,7 +426,7 @@ volumes:
426426
```
427427
428428
> [!NOTE]
429-
> 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.
429+
> Ensure you have an `.env` file at the root of your Laravel project with the necessary configurations to match the Docker Compose setup.
430430

431431
## Running your production environment
432432

0 commit comments

Comments
 (0)