Skip to content

docs: add Docker for Python development guide#5

Open
agent-kurouto[bot] wants to merge 2 commits intodevfrom
eywalker/plt-1026-add-docker-for-python-development-guide-to-nauticalabpython
Open

docs: add Docker for Python development guide#5
agent-kurouto[bot] wants to merge 2 commits intodevfrom
eywalker/plt-1026-add-docker-for-python-development-guide-to-nauticalabpython

Conversation

@agent-kurouto
Copy link
Contributor

@agent-kurouto agent-kurouto bot commented Mar 19, 2026

Summary

  • Adds docs/docker.md covering Docker best practices for intermediate Python developers
  • Updates README.md to include the new guide in the Contents table

What's in the guide

  1. Why Use Docker — reproducibility, isolation, CI/prod parity
  2. Writing a Good Dockerfile — slim base images, multi-stage builds, layer caching, PYTHONUNBUFFERED/PYTHONDONTWRITEBYTECODE
  3. Managing Dependenciesuv (recommended), pip-tools, pip freeze; copy requirements before source code
  4. Docker Compose for Local Development — volume mounts for hot-reload, override files
  5. Common Pitfalls — running as root, bloated images, missing .dockerignore, unbuffered output
  6. Production-Ready Dockerfile Example — multi-stage, non-root user, uv, .dockerignore guidance

Test plan

  • Render docs/docker.md locally and confirm formatting is correct
  • Verify all code blocks are syntactically valid
  • Confirm README table links resolve correctly

Closes PLT-1026

🤖 Generated with Claude Code

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
@eywalker eywalker requested a review from Copilot March 19, 2026 11:28
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.md with Dockerfile, dependency, Compose, and pitfalls guidance for Python development.
  • Updated README.md Contents 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant