Fix worker Docker builds for dnspython and py3.9 numpy pin#5142
Conversation
dnspython 2.6.1 requires Python 3.8+, but worker_py3_7 and remote-worker images use Python 3.7. Override to dnspython 2.3.0 during those builds, matching the existing PyJWT version override pattern. Remove numpy==1.18.1 from the prod worker_py3_9 pre-install step. That pin is for older worker stacks and conflicts with scipy/sklearn in worker_py3_9.txt (numpy 1.26.4), causing metadata-generation failures. Co-authored-by: Rishabh Jain <rishabhjain2018@gmail.com>
WalkthroughUpdates Docker build files: worker_py3_7 (dev and prod) Dockerfiles now pin dnspython to 2.3.0 alongside the existing PyJWT 2.8.0 pin via combined sed commands, while the worker_py3_9 Dockerfile removes an explicit numpy==1.18.1 pin from its builder-stage pip install. ChangesDocker worker Dockerfile dependency updates
Estimated code review effort: 1 (Trivial) | ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
docker/prod/worker_py3_9/Dockerfile (1)
82-83: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winConsider adding numpy/scipy to the import verification step.
The runtime import check on line 83 covers core dependencies but not the scientific computing stack (
numpy,scipy,scikit-learn). Since this PR changes how numpy is installed, adding these to the verification would catch build or resolution failures early rather than at worker runtime.💡 Suggested addition to import verification
# Verify worker runtime imports required by submission_worker.py. -RUN python -c "import boto3, botocore, django, requests, yaml" +RUN python -c "import boto3, botocore, django, requests, yaml, numpy, scipy, sklearn"🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docker/prod/worker_py3_9/Dockerfile` around lines 82 - 83, The worker runtime import verification currently checks only core packages and can miss failures in the scientific stack. Update the Dockerfile’s import check that runs python to also import numpy, scipy, and scikit-learn so build or dependency resolution issues are caught during image निर्माण instead of at worker runtime. Keep the check in the same verification step used for submission_worker.py so the runtime dependency set is validated consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@docker/prod/worker_py3_9/Dockerfile`:
- Around line 82-83: The worker runtime import verification currently checks
only core packages and can miss failures in the scientific stack. Update the
Dockerfile’s import check that runs python to also import numpy, scipy, and
scikit-learn so build or dependency resolution issues are caught during image
निर्माण instead of at worker runtime. Keep the check in the same verification
step used for submission_worker.py so the runtime dependency set is validated
consistently.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 2cc8b329-1e6c-4c3f-8827-cd94981f0619
📒 Files selected for processing (3)
docker/dev/worker_py3_7/Dockerfiledocker/prod/worker_py3_7/Dockerfiledocker/prod/worker_py3_9/Dockerfile
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Summary
Fixes Docker image build failures for
worker_py3_7,remote-worker, andworker_py3_9during staging/production packaging.Problem
dnspython==2.6.1on Python 3.7 workers —dnspython2.4+ requires Python 3.8+. Theworker_py3_7andremote-workerimages (both built from the py3.7 Dockerfile) fail with:Available versions on Python 3.7 stop at 2.3.0.
numpy==1.18.1pre-install on prodworker_py3_9— The production py3.9 worker Dockerfile pre-installsnumpy==1.18.1beforeworker_py3_9.txt, which pinsnumpy==1.26.4and pulls inscipy==1.11.4/scikit-learn==1.4.2. The stale numpy pin causesmetadata-generation-failedduring pip resolution. The dev py3.9 Dockerfile does not pre-install numpy and avoids this issue.Solution
dnspythonto2.3.0in py3.7 worker Docker builds, following the samesedpattern already used forPyJWTversion overrides.numpy==1.18.1pre-install from the prodworker_py3_9Dockerfile;cython==0.29.36remains as the compile prerequisite.Notes
dnspython==2.6.1fromrequirements/common.txtfor the CVE-2023-29483 fix.dnspythontransitively viaprod.txt; they do not run account email validation, but the dependency must install cleanly.dns.resolver.resolve()used in the Django app is available in dnspython 2.3.0.Testing
worker_py3_7,worker_py3_8,worker_py3_9)docker compose buildsucceedsSummary by CodeRabbit