-
Notifications
You must be signed in to change notification settings - Fork 0
support ARM64 with official Ruby + jemalloc #22
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?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Summary
This PR successfully adds ARM64 support to the Docker base image, which is a valuable enhancement for running on Graviton instances. However, there are several critical issues that need to be addressed before merging:
Critical Issues Found:
- Security vulnerability in Dockerfile: The wildcard pattern in the jemalloc symbolic link could cause unpredictable behavior across architectures
- Logic error in sync script: The ARM64 tagging approach breaks Docker's multi-architecture support by creating separate tags instead of proper multi-arch manifests
- Missing error handling: The sync script lacks proper error handling for Docker operations
Performance Improvements:
- GitHub Actions workflow should include build caching to improve multi-architecture build times
- Documentation should use generic version placeholders instead of hardcoded version numbers
Overall Assessment:
The core changes (switching from fullstaq-ruby to official Ruby + jemalloc, adding multi-arch CI support) are well-implemented. The main concerns are around the deployment script architecture handling and some security/reliability improvements needed in the Dockerfile.
Please address the critical issues, particularly the jemalloc symbolic link and the multi-architecture manifest handling in the sync script, before merging.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
|
[ch97578] |
|
/q review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
This PR successfully adds ARM64 support by migrating from fullstaq-ruby to the official Ruby image with manual jemalloc installation. The changes are well-structured and the multi-architecture build setup is appropriate.
Critical Issues Found
-
Dockerfile: The jemalloc symbolic link creation could fail silently, causing runtime crashes when
LD_PRELOADattempts to load a missing library. -
sync-to-ecr.sh: The script assumes both base and
-testingtags exist without verification, which will cause sync failures if only the base version is available.
Recommendations
- Add explicit error handling for jemalloc library detection in the Dockerfile
- Include build caching in the GitHub Actions workflow to improve multi-arch build performance
- Add tag existence verification in the ECR sync script
- Update documentation to include script permission setup
The ARM64 support implementation is solid, but these reliability improvements are essential for production deployment.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
|
/q review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review Summary
This PR successfully adds ARM64 support to the Docker base image by switching from fullstaq-ruby to the official Ruby image and implementing jemalloc via LD_PRELOAD. The multi-architecture build setup and ECR sync script are well-implemented.
Critical Security Issues Found
I've identified 3 security vulnerabilities that must be addressed before merging:
- Dockerfile: Unsafe script download without integrity checks
- sync-to-ecr.sh: Unquoted shell variables creating command injection risks (2 instances)
All issues have specific code suggestions provided for easy fixes. Please apply the suggested changes to resolve these security concerns.
Overall Assessment
The architectural changes are sound and the ARM64 support implementation is appropriate. Once the security issues are resolved, this PR will be ready for merge.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
|
/q review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Summary
This PR successfully adds ARM64 support by switching from fullstaq-ruby to the official Ruby image and implementing multi-architecture builds. The changes are well-structured and the approach is sound.
Critical Issues Found:
- Security vulnerability in Dockerfile: The
curl | bashpattern for installing Volta lacks integrity checks, creating a supply chain attack vector - Version inconsistency in README: Bundler version mismatch between documentation (2.4.20) and actual implementation (2.4.22)
- Workflow reliability: ECR sync job lacks proper error handling
Recommendations:
- Fix the security issue by adding proper curl flags for the Volta installation
- Update the README to reflect the correct Bundler version
- Consider adding explicit success condition to the ECR sync job
The ARM64 support implementation looks solid, and the jemalloc integration via LD_PRELOAD is a good approach for maintaining memory optimization across architectures.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
Dockerfile
Outdated
| RUN curl https://get.volta.sh | bash | ||
| RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates \ | ||
| && rm -rf /var/lib/apt/lists/* \ | ||
| && curl https://get.volta.sh | bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛑 Security Vulnerability: Downloading and executing shell scripts from external sources without verification creates a supply chain attack vector1. The curl | bash command executes arbitrary code from the internet without integrity checks.
| && curl https://get.volta.sh | bash | |
| && curl -fsSL | bash |
Footnotes
-
CWE-494: Download of Code Without Integrity Check - https://cwe.mitre.org/data/definitions/494.html ↩
| sync-to-ecr: | ||
| name: Sync to ECR Public | ||
| needs: build-and-push-docker-image | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ECR sync job will fail if the DockerHub push fails, but there's no error handling or retry mechanism. Consider adding error handling or making the ECR sync conditional on successful DockerHub push.
| sync-to-ecr: | |
| name: Sync to ECR Public | |
| needs: build-and-push-docker-image | |
| runs-on: ubuntu-latest | |
| steps: | |
| sync-to-ecr: | |
| name: Sync to ECR Public | |
| needs: build-and-push-docker-image | |
| runs-on: ubuntu-latest | |
| if: success() | |
| steps: |
README.md
Outdated
| | 0.30.3 | 2.7.7 | 14.21.2 | 1.22.19 | 2.4.5 | | | ||
| | Version | Ruby | Node.js | Yarn | Bundler | pnpm | ARM64 | | ||
| |---------|-------|---------|---------|---------|-------|-------| | ||
| | 0.32.0 | 2.7.8 | 18.18.0 | 1.22.22 | 2.4.20 | 9.9.0 | ✅ | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Bundler version in the table shows 2.4.20 but the Dockerfile uses 2.4.22. This inconsistency could confuse users about which version is actually included in the image.
| | 0.32.0 | 2.7.8 | 18.18.0 | 1.22.22 | 2.4.20 | 9.9.0 | ✅ | | |
| | 0.32.0 | 2.7.8 | 18.18.0 | 1.22.22 | 2.4.22 | 9.9.0 | ✅ | |
47266c8 to
be44e82
Compare
|
/q review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Summary
This PR successfully adds ARM64 support by switching from fullstaq-ruby to the official Ruby image and implementing manual jemalloc installation. The changes are well-structured and the multi-architecture build setup looks solid.
Key Changes Reviewed:
- ✅ Dockerfile: Proper transition to official Ruby image with manual jemalloc setup
- ✅ GitHub Actions: Multi-arch build configuration with ECR sync
- ✅ Documentation: Clear ARM64 support documentation and updated version table
Critical Issues Found:
- Security: Volta installation script downloaded without integrity verification
- Build Process: Missing error handling for volta installation
- Infrastructure: ECR sync job missing Docker Buildx setup
Recommendation:
Address the security and build reliability issues before merging. The core ARM64 implementation is sound, but the identified issues could cause build failures or security vulnerabilities in production.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
| RUN apt-get update && apt-get install -y --no-install-recommends libjemalloc2 \ | ||
| && JEMALLOC_PATH=$(find /usr/lib -name "libjemalloc.so.2" | head -1) \ | ||
| && [ -n "$JEMALLOC_PATH" ] || (echo "libjemalloc.so.2 not found" && exit 1) \ | ||
| && ln -sf "$JEMALLOC_PATH" /usr/lib/libjemalloc.so.2 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛑 Logic Error: The symlink creation will fail if /usr/lib/libjemalloc.so.2 already exists. Use ln -sf to force overwrite or check if the symlink already exists before creating it.
| && ln -sf "$JEMALLOC_PATH" /usr/lib/libjemalloc.so.2 \ | |
| && ln -sf "$JEMALLOC_PATH" /usr/lib/libjemalloc.so.2 \ |
| && [ -n "$JEMALLOC_PATH" ] || (echo "libjemalloc.so.2 not found" && exit 1) \ | ||
| && ln -sf "$JEMALLOC_PATH" /usr/lib/libjemalloc.so.2 \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
| ENV LD_PRELOAD=/usr/lib/libjemalloc.so.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛑 Portability Issue: Hardcoded LD_PRELOAD path may not work across ARM64 and AMD64 architectures. The jemalloc library path can vary between architectures.
| ENV LD_PRELOAD=/usr/lib/libjemalloc.so.2 | |
| ENV LD_PRELOAD=/usr/lib/libjemalloc.so.2 |
| RUN curl https://get.volta.sh | bash | ||
| RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates \ | ||
| && rm -rf /var/lib/apt/lists/* \ | ||
| && curl -fsSL https://get.volta.sh | bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛑 Security Vulnerability: Downloading and executing scripts from external sources without integrity verification poses a security risk. Consider verifying the script checksum or using a pinned version.
1f22346 to
6855fc6
Compare
- Switch from fullstaq-ruby to official ruby:2.7.8-slim (fullstaq doesn't support ARM64) - Add libjemalloc2 with LD_PRELOAD for memory optimization - Implement multi-arch builds (linux/amd64 + linux/arm64) using QEMU + buildx - Automate ECR Public sync in GitHub Actions workflow - Translate all documentation and comments to English - Fix hadolint warnings and security issues
6855fc6 to
5eccf2f
Compare
Summary
Add ARM64 architecture support to enable iCook, tv, market, newsroom, and other Rails projects to run on Graviton instances.
Changes
Dockerfile
ruby:2.7.8-slim(fullstaq doesn't support ARM64)libjemalloc2withLD_PRELOADfor memory optimization.github/workflows/release.yml
linux/amd64andlinux/arm64README.md
Release Flow
Related