docs: add Docker for Python development guide#5
Open
agent-kurouto[bot] wants to merge 2 commits intodevfrom
Open
docs: add Docker for Python development guide#5agent-kurouto[bot] wants to merge 2 commits intodevfrom
agent-kurouto[bot] wants to merge 2 commits intodevfrom
Conversation
Adds docs/docker.md covering Dockerfile best practices (multi-stage builds, slim base images, layer caching), dependency management with uv and pip-tools, Docker Compose for local development with hot-reload, and common pitfalls (root user, bloated images, missing .dockerignore). Includes a complete production-ready Dockerfile example. Updates README.md to link the new guide in the Contents table. Closes PLT-1026
There was a problem hiding this comment.
Pull request overview
Adds a new Docker guide to the repository’s documentation set and links it from the main README, expanding the Python best-practices collection with containerization guidance.
Changes:
- Added
docs/docker.mdwith Dockerfile, dependency, Compose, and pitfalls guidance for Python development. - Updated
README.mdContents table to link to the new Docker guide.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| README.md | Adds the new “Docker for Python” guide link to the Contents table. |
| docs/docker.md | Introduces a full Docker-for-Python development guide with examples and recommendations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
docs/docker.md
Outdated
| COPY --from=builder /build/.venv /app/.venv | ||
| ENV PATH="/app/.venv/bin:$PATH" | ||
|
|
||
| COPY src/ ./src/ |
docs/docker.md
Outdated
| WORKDIR /build | ||
|
|
||
| # Install uv for fast dependency installation | ||
| COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv |
docs/docker.md
Outdated
Comment on lines
+272
to
+275
| # Install dependencies into a virtualenv (no dev deps, no editable installs) | ||
| COPY pyproject.toml uv.lock ./ | ||
| RUN uv sync --frozen --no-dev --no-install-project | ||
|
|
docs/docker.md
Outdated
Comment on lines
+289
to
+292
| COPY --from=builder /build/.venv /app/.venv | ||
|
|
||
| # Copy application source | ||
| COPY src/ ./src/ |
docs/docker.md
Outdated
| PYTHONUNBUFFERED=1 | ||
|
|
||
| # Bring in uv | ||
| COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv |
- Pin uv image tag to 0.5.0 (was :latest) in both the multi-stage example and the production Dockerfile, with a comment pointing to the releases page for updates - Fix --no-install-project + CMD mismatch: use a two-step uv sync (deps-only first for cache efficiency, then full project install) so the package is importable in the runtime stage without needing PYTHONPATH or a separate COPY src/ - Add --chown=appuser:appuser to the COPY --from=builder instruction in the runtime stage so files are owned by the non-root user from the start, avoiding permission errors at runtime
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
docs/docker.mdcovering Docker best practices for intermediate Python developersREADME.mdto include the new guide in the Contents tableWhat's in the guide
PYTHONUNBUFFERED/PYTHONDONTWRITEBYTECODEuv(recommended),pip-tools,pip freeze; copy requirements before source code.dockerignore, unbuffered outputuv,.dockerignoreguidanceTest plan
docs/docker.mdlocally and confirm formatting is correctCloses PLT-1026
🤖 Generated with Claude Code