tests: increase PHP memory limit to 512M in Dockerfile#778
Conversation
WalkthroughAdds a PHP memory limit configuration during Docker image build and includes Composer by copying the binary from a composer:2 stage into the final image. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Dev as Docker Build
participant Base as PHP Base Image
participant Cmp as composer:2 Stage
participant Final as Final Image
Dev->>Base: Start build from PHP base image
Note right of Base: Configure PHP
Base->>Base: Create /usr/local/etc/php/conf.d/memory-limit.ini (512M)
Dev->>Cmp: Access composer:2 stage
Cmp-->>Final: Copy /usr/bin/composer -> /usr/local/bin/composer
Note over Final: Image now has PHP memory limit and Composer
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
Dockerfile (1)
8-9: Make memory limit configurable and ensure precedence.To keep this flexible across environments and avoid being overridden by other INIs, consider:
- Parameterizing the value via a build arg.
- Using a zz- prefix so it wins on load order.
- Ensuring the conf.d directory exists and using a more robust printf.
Apply this diff within the current lines to improve robustness:
-RUN echo "memory_limit = 512M" > /usr/local/etc/php/conf.d/memory-limit.ini +RUN set -eux; \ + mkdir -p /usr/local/etc/php/conf.d; \ + printf "memory_limit = %s\n" "${PHP_MEMORY_LIMIT:-512M}" > /usr/local/etc/php/conf.d/zz-memory-limit.iniAdditionally, add the following Dockerfile line above this RUN to enable configuration via build-arg:
ARG PHP_MEMORY_LIMIT=512MYou can then override at build time with:
docker build --build-arg PHP_MEMORY_LIMIT=768M .
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
Dockerfile(1 hunks)
🔇 Additional comments (1)
Dockerfile (1)
8-9: Change is correct and aligns with PHP image conventions.Writing a dedicated INI in /usr/local/etc/php/conf.d is the right way to set memory_limit in php:8.2. This will apply to CLI and should unblock phpstan in CI and on Apple Silicon.
|
Hello @bpolaszek and thanks for your first contribution 🙌 We'll merge this after the tests are fixed in #780 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #778 +/- ##
=======================================
Coverage 89.78% 89.78%
=======================================
Files 59 59
Lines 1449 1449
=======================================
Hits 1301 1301
Misses 148 148 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Hello there,
When running
docker-compose run --rm package bash -c "composer install && composer test && composer lint && composer phpstan"I got memory_limit errors during the phpstan step (Mac M4).I suggest to raise the default limit from 128M to 512M to avoid these errors.
Summary by CodeRabbit
New Features
Chores