Repository navigation
fix(docker): use python:3.11-slim base for >=3.9 requirement - #345
Conversation
The Publish Docker image workflow broke on master after the minimum Python bump to 3.9: the base image dptechnology/dflow:latest ships Python 3.8.20, so `pip install .` aborts with "Package 'dpgen2' requires a different Python: 3.8.20 not in '>=3.9'". Switch the base to python:3.11-slim. pydflow is a declared dependency of dpgen2, so it is installed by `pip install .` and need not be baked into the base image. All install-time dependencies ship manylinux wheels (no source build), so the slim image is sufficient.
|
Warning Review limit reached
More reviews will be available in 38 minutes and 23 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe Dockerfile's base image is updated from the custom deep flow container ( ChangesContainer Base Image Update
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
Dockerfile (1)
1-5:⚠️ Potential issue | 🟠 Major | ⚡ Quick winRun the image as a non-root user before publish
Line 1–5 builds a published image that defaults to
rootbecause noUSERis set. Given.github/workflows/pub-docker.ymlpushes this image, this weakens runtime isolation unnecessarily.Proposed hardening patch
FROM python:3.11-slim WORKDIR /data/dpgen2 COPY ./ ./ RUN pip install --no-cache-dir . +RUN useradd --create-home --uid 10001 appuser && chown -R appuser:appuser /data/dpgen2 +USER appuser🤖 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 `@Dockerfile` around lines 1 - 5, The Dockerfile currently runs as root; add a non-root user and switch to it before publishing: create a dedicated user and group (e.g., appuser), ensure ownership of WORKDIR (/data/dpgen2) and any installed files is changed to that user (use RUN to addgroup/adduser and chown the WORKDIR after COPY and pip install), then set USER to that non-root user at the end of the Dockerfile so subsequent containers run unprivileged; reference the existing WORKDIR, COPY, RUN pip install, and add a final USER instruction to apply this change.Source: Linters/SAST tools
🤖 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.
Outside diff comments:
In `@Dockerfile`:
- Around line 1-5: The Dockerfile currently runs as root; add a non-root user
and switch to it before publishing: create a dedicated user and group (e.g.,
appuser), ensure ownership of WORKDIR (/data/dpgen2) and any installed files is
changed to that user (use RUN to addgroup/adduser and chown the WORKDIR after
COPY and pip install), then set USER to that non-root user at the end of the
Dockerfile so subsequent containers run unprivileged; reference the existing
WORKDIR, COPY, RUN pip install, and add a final USER instruction to apply this
change.
Add a build-only (push: false) workflow that builds the Dockerfile on pull requests touching Dockerfile / pyproject.toml. The existing Publish Docker image workflow only runs on push to master and on release, so base-image problems (such as the recent Python 3.8 vs >=3.9 mismatch) were only discovered after merge. This job requires no registry login or secrets, so it also works for fork pull requests.
python:3.11-slim has no git, but the build backend (setuptools_scm) shells out to git to derive the version from the repository, so `pip install .` failed at "Getting requirements to build wheel". Install git in the image before the build. The old dflow base happened to carry git, which masked this requirement.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #345 +/- ##
=======================================
Coverage 84.19% 84.19%
=======================================
Files 104 104
Lines 6107 6107
=======================================
Hits 5142 5142
Misses 965 965 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Problem
The Publish Docker image workflow (
.github/workflows/pub-docker.yml) fails onmasterafter the minimum-Python bump to 3.9:The
Dockerfilebasedptechnology/dflow:latestships Python 3.8.20, whilepyproject.tomlnow declaresrequires-python = ">=3.9", sopip install .aborts.Why it wasn't caught pre-merge
pub-docker.ymlonly triggers onpush: master/release(nopull_request), and the unit-test workflow provisions Python viaactions/setup-pythonrather than the Dockerfile — so nothing builds the image on PRs. The breakage only surfaces on the post-merge push tomaster.Fix
Dockerfile— switch the base image topython:3.11-slim.pydflowis a declared dependency of dpgen2, so it is installed bypip install .and need not be baked into the base image (the old dflow base was effectively "python 3.8 + pydflow").cp311manylinux wheels, so no source compilation is needed and the slim image is sufficient..github/workflows/test-docker.yml(new) — a build-only (push: false) workflow that builds the Dockerfile on pull requests touchingDockerfile/pyproject.toml. It requires no registry login or secrets, so it also works for fork PRs, and it closes the gap that let this breakage reachmasterunnoticed.Validation
The new build-only workflow runs on this PR (it touches both
Dockerfileand the workflow file), so the base-image fix is validated here before merge.