-
Notifications
You must be signed in to change notification settings - Fork 4
Add support for Laravel Octane with multiple drivers while retaining PHP-FPM/Nginx setup #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
8919813
e6c2981
48a10ad
34ae936
a4ab8a8
3ac0a75
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -53,9 +53,9 @@ RUN docker-php-ext-configure gd --with-freetype --with-jpeg \ | |||||||||||||||||||
| zip \ | ||||||||||||||||||||
| pcntl \ | ||||||||||||||||||||
| sockets \ | ||||||||||||||||||||
| # PECL | ||||||||||||||||||||
| && pecl install redis \ | ||||||||||||||||||||
| && docker-php-ext-enable redis \ | ||||||||||||||||||||
| # PECL - Install redis and swoole (for Laravel Octane with Swoole) | ||||||||||||||||||||
| && pecl install redis swoole \ | ||||||||||||||||||||
| && docker-php-ext-enable redis swoole \ | ||||||||||||||||||||
| # Cleanup after PHP extensions are built | ||||||||||||||||||||
| && apk del build-base autoconf automake libtool nasm git \ | ||||||||||||||||||||
| && rm -rf /var/cache/apk/* /tmp/* /var/tmp/* | ||||||||||||||||||||
|
|
@@ -126,6 +126,16 @@ RUN CACHE_STORE=array php -d memory_limit=512M artisan event:cache --no-interact | |||||||||||||||||||
| CACHE_STORE=array php -d memory_limit=512M artisan icons:cache --no-interaction --no-ansi && \ | ||||||||||||||||||||
| CACHE_STORE=array php -d memory_limit=512M artisan filament:cache-components --no-interaction --no-ansi | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Download RoadRunner binary for Laravel Octane | ||||||||||||||||||||
| RUN curl -sSL https://github.com/roadrunner-server/roadrunner/releases/download/v2024.2.1/roadrunner-2024.2.1-linux-amd64.tar.gz \ | ||||||||||||||||||||
| | tar -xz -C /usr/local/bin roadrunner && \ | ||||||||||||||||||||
| chmod +x /usr/local/bin/roadrunner | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
Comment on lines
+129
to
+133
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add pipefail and consider checksum verification for binary downloads. The RoadRunner download uses a pipe without the Apply this diff to add pipefail and improve error handling: # Download RoadRunner binary for Laravel Octane
-RUN curl -sSL https://github.com/roadrunner-server/roadrunner/releases/download/v2024.2.1/roadrunner-2024.2.1-linux-amd64.tar.gz \
- | tar -xz -C /usr/local/bin roadrunner && \
+RUN set -o pipefail && \
+ curl -sSL https://github.com/roadrunner-server/roadrunner/releases/download/v2024.2.1/roadrunner-2024.2.1-linux-amd64.tar.gz \
+ | tar -xz -C /usr/local/bin roadrunner && \
chmod +x /usr/local/bin/roadrunnerOptional enhancement: Consider verifying checksums for both binaries to ensure integrity and security. You can obtain checksums from the respective GitHub release pages. Based on static analysis hints. 📝 Committable suggestion
Suggested change
🧰 Tools🪛 Hadolint (2.14.0)[warning] 130-130: Set the SHELL option -o pipefail before RUN with a pipe in it. If you are using /bin/sh in an alpine image or if your shell is symlinked to busybox then consider explicitly setting your SHELL to /bin/ash, or disable this check (DL4006) 🤖 Prompt for AI AgentsThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot In docker/Dockerfile around lines 129 to 133, the RoadRunner download uses a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||||||
| # Download FrankenPHP binary for Laravel Octane | ||||||||||||||||||||
| RUN curl -sSL https://github.com/dunglas/frankenphp/releases/download/v1.3.5/frankenphp-linux-x86_64 \ | ||||||||||||||||||||
| -o /usr/local/bin/frankenphp && \ | ||||||||||||||||||||
| chmod +x /usr/local/bin/frankenphp | ||||||||||||||||||||
|
Comment on lines
+130
to
+137
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify that binary versions are current and consider platform compatibility. The Dockerfile downloads specific versions of RoadRunner (v2024.2.1) and FrankenPHP (v1.3.5). Additionally, the binaries are hardcoded for x86_64 architecture, which won't work on ARM-based systems (e.g., Apple Silicon, AWS Graviton). Run the following script to check for the latest versions: 🏁 Script executed: #!/bin/bash
# Description: Check latest versions of RoadRunner and FrankenPHP
echo "=== Latest RoadRunner Release ==="
gh api repos/roadrunner-server/roadrunner/releases/latest --jq '.tag_name, .published_at'
echo ""
echo "=== Latest FrankenPHP Release ==="
gh api repos/dunglas/frankenphp/releases/latest --jq '.tag_name, .published_at'
echo ""
echo "=== Current versions in Dockerfile ==="
rg -n "roadrunner.*v[0-9]" docker/Dockerfile
rg -n "frankenphp.*v[0-9]" docker/DockerfileLength of output: 283 Length of output: 1049 🌐 Web query: 💡 Result: Yes — official RoadRunner releases include Linux ARM64 binaries. The roadrunner v2025.1.2 release (published 2025-06-14) includes a linux-arm64 asset, and earlier releases added linux/arm64 Docker support. (github.com) Citations: 🌐 Web query: 💡 Result: Yes — FrankenPHP GitHub releases include ARM64 / aarch64 builds (e.g., frankenphp-linux-aarch64 and frankenphp-*.aarch64.rpm in the release assets). [1][2] Sources:
Update binary versions and add platform-agnostic architecture detection. The Dockerfile downloads outdated binaries: RoadRunner v2024.2.1 (latest is v2025.1.4, released 2025-10-02) and FrankenPHP v1.3.5 (latest is v1.9.1, released 2025-08-29). Additionally, both binaries are hardcoded for x86_64 architecture, which will fail on ARM-based systems (e.g., Apple Silicon, AWS Graviton) even though both projects publish ARM64 binaries. Lines 130–137 require:
🧰 Tools🪛 Hadolint (2.14.0)[warning] 130-130: Set the SHELL option -o pipefail before RUN with a pipe in it. If you are using /bin/sh in an alpine image or if your shell is symlinked to busybox then consider explicitly setting your SHELL to /bin/ash, or disable this check (DL4006) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot Update RoadRunner to v2025.1.4 or later There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| # ======================================== | ||||||||||||||||||||
| # Stage 3: Final application image | ||||||||||||||||||||
| # ======================================== | ||||||||||||||||||||
|
|
@@ -137,23 +147,32 @@ WORKDIR /var/www/html | |||||||||||||||||||
| # Copy built application from the builder stage | ||||||||||||||||||||
| COPY --from=builder --chown=www-data:www-data /var/www/html . | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Copy Octane binaries from builder stage | ||||||||||||||||||||
| COPY --from=builder /usr/local/bin/roadrunner /usr/local/bin/roadrunner | ||||||||||||||||||||
| COPY --from=builder /usr/local/bin/frankenphp /usr/local/bin/frankenphp | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Copy configuration files | ||||||||||||||||||||
| COPY docker/.profile /root/.profile | ||||||||||||||||||||
| COPY --chown=www-data:www-data docker/nginx/ /etc/nginx | ||||||||||||||||||||
| COPY docker/php/php-fpm.conf /usr/local/etc/php-fpm.d/www.conf | ||||||||||||||||||||
| COPY docker/php/php.ini /usr/local/etc/php/conf.d/99-custom.ini | ||||||||||||||||||||
| COPY docker/supervisord-web.conf /etc/supervisor/conf.d/supervisord-web.conf | ||||||||||||||||||||
| COPY docker/supervisord-web-octane-swoole.conf /etc/supervisor/conf.d/supervisord-web-octane-swoole.conf | ||||||||||||||||||||
| COPY docker/supervisord-web-octane-roadrunner.conf /etc/supervisor/conf.d/supervisord-web-octane-roadrunner.conf | ||||||||||||||||||||
| COPY docker/supervisord-web-octane-frankenphp.conf /etc/supervisor/conf.d/supervisord-web-octane-frankenphp.conf | ||||||||||||||||||||
| COPY docker/supervisord-queue-worker.conf /etc/supervisor/conf.d/supervisord-queue-worker.conf | ||||||||||||||||||||
| COPY docker/supervisord-scheduler.conf /etc/supervisor/conf.d/supervisord-scheduler.conf | ||||||||||||||||||||
| COPY docker/entrypoint.sh /entrypoint.sh | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Make entrypoint executable and create supervisor log directory | ||||||||||||||||||||
| # Disable Octane config by default (will be enabled by entrypoint.sh if APP_SERVER_MODE=octane) | ||||||||||||||||||||
| RUN chmod +x /entrypoint.sh \ | ||||||||||||||||||||
| && mkdir -p /var/log/supervisor \ | ||||||||||||||||||||
| && mkdir -p /var/www/html/storage /var/www/html/bootstrap/cache \ | ||||||||||||||||||||
| && chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache \ | ||||||||||||||||||||
| && chmod -R 775 /var/www/html/storage /var/www/html/bootstrap/cache \ | ||||||||||||||||||||
| && chown -R www-data:www-data /etc/nginx/custom.d \ | ||||||||||||||||||||
| && mv /etc/nginx/custom.d/laravel-octane.conf /etc/nginx/custom.d/.laravel-octane.conf \ | ||||||||||||||||||||
| && mkdir -p /var/lib/nginx/tmp/client_body \ | ||||||||||||||||||||
| /var/lib/nginx/tmp/proxy \ | ||||||||||||||||||||
| /var/lib/nginx/tmp/fastcgi \ | ||||||||||||||||||||
|
|
||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.