fix: Rewrite Dockerfile for Python and fix consistency issues - #3
Conversation
Critical fixes: - Dockerfile: Replace Node.js config with Python 3.12 + uv (was using FROM node:20-alpine for a Python project) Additional fixes: - agent-card.json: Add protect_toggle_privacy to confirmation_required - agent-card.json: Update Python requirement to >=3.10 for consistency - README.md: Update Python version to 3.10+ to match badge and agent-card - docker-build-push.yml: Fix digest output reference (meta → build-push) Found by CodeRabbit review. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis pull request migrates the application stack from Node.js 20 to Python 3.12 across Docker, CI/CD, and configuration files. The Dockerfile is updated with a Python base image and corresponding build tooling, while supporting files adjust version requirements and workflow outputs accordingly. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@Dockerfile`:
- Around line 13-23: The editable install fails because the build backend reads
the README declared in pyproject.toml before README.md is present; update the
Dockerfile so that README.md (and the rest of source files) are copied into the
image before running the editable install: move the COPY . . (or at minimum COPY
README.md ./) to occur before the RUN uv pip install --system -e . step so that
pyproject.toml can find README.md during the editable install.
| # Install uv for fast Python package management | ||
| RUN pip install --no-cache-dir uv | ||
|
|
||
| RUN npm ci --only=production && npm cache clean --force | ||
| # Copy dependency files first for better caching | ||
| COPY pyproject.toml ./ | ||
|
|
||
| # Install dependencies | ||
| RUN uv pip install --system -e . | ||
|
|
||
| # Copy application code | ||
| COPY . . |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# Find the Dockerfile
find . -name "Dockerfile" -type fRepository: ry-ops/unifi-mcp-server
Length of output: 79
🏁 Script executed:
# Examine the Dockerfile content
cat -n ./DockerfileRepository: ry-ops/unifi-mcp-server
Length of output: 1339
🏁 Script executed:
# Also check if there's a pyproject.toml to understand the build backend
cat -n ./pyproject.tomlRepository: ry-ops/unifi-mcp-server
Length of output: 388
🏁 Script executed:
# Check if README.md exists in the repository
ls -la README.mdRepository: ry-ops/unifi-mcp-server
Length of output: 126
Editable install will fail—README.md not available when build backend reads pyproject.toml.
The editable install on line 20 cannot succeed because pyproject.toml declares readme = "README.md", which the build backend will attempt to read during installation. However, README.md is not copied into the container until line 23. This causes the build to fail.
Move COPY . . before the install to ensure all source files and metadata are available:
Proposed fix
-# Copy dependency files first for better caching
-COPY pyproject.toml ./
-
-# Install dependencies
-RUN uv pip install --system -e .
-
-# Copy application code
-COPY . .
+# Copy application code (needed for editable install metadata)
+COPY . .
+
+# Install dependencies
+RUN uv pip install --system -e .🤖 Prompt for AI Agents
In `@Dockerfile` around lines 13 - 23, The editable install fails because the
build backend reads the README declared in pyproject.toml before README.md is
present; update the Dockerfile so that README.md (and the rest of source files)
are copied into the image before running the editable install: move the COPY . .
(or at minimum COPY README.md ./) to occur before the RUN uv pip install
--system -e . step so that pyproject.toml can find README.md during the editable
install.
There was a problem hiding this comment.
2 issues found across 4 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="README.md">
<violation number="1" location="README.md:91">
P2: README lists Python 3.10+, but the project requires Python >=3.12 in pyproject.toml. This misleads users about the minimum supported version. Update the README to match the enforced requirement.</violation>
</file>
<file name="Dockerfile">
<violation number="1" location="Dockerfile:20">
P1: `uv pip install --system -e .` runs before README.md and source files are copied. Since pyproject.toml references README.md, the editable install can fail because the project files aren’t available yet. Install dependencies from pyproject directly (or copy README/source before the install) to avoid build-time failures.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| COPY pyproject.toml ./ | ||
|
|
||
| # Install dependencies | ||
| RUN uv pip install --system -e . |
There was a problem hiding this comment.
P1: uv pip install --system -e . runs before README.md and source files are copied. Since pyproject.toml references README.md, the editable install can fail because the project files aren’t available yet. Install dependencies from pyproject directly (or copy README/source before the install) to avoid build-time failures.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At Dockerfile, line 20:
<comment>`uv pip install --system -e .` runs before README.md and source files are copied. Since pyproject.toml references README.md, the editable install can fail because the project files aren’t available yet. Install dependencies from pyproject directly (or copy README/source before the install) to avoid build-time failures.</comment>
<file context>
@@ -10,24 +10,31 @@ RUN apk add --no-cache ca-certificates curl
+COPY pyproject.toml ./
+# Install dependencies
+RUN uv pip install --system -e .
+
+# Copy application code
</file context>
| ## Prerequisites | ||
|
|
||
| - Python 3.8 or higher | ||
| - Python 3.10 or higher |
There was a problem hiding this comment.
P2: README lists Python 3.10+, but the project requires Python >=3.12 in pyproject.toml. This misleads users about the minimum supported version. Update the README to match the enforced requirement.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At README.md, line 91:
<comment>README lists Python 3.10+, but the project requires Python >=3.12 in pyproject.toml. This misleads users about the minimum supported version. Update the README to match the enforced requirement.</comment>
<file context>
@@ -88,7 +88,7 @@ For agent-to-agent communication, agents can:
## Prerequisites
-- Python 3.8 or higher
+- Python 3.10 or higher
- `uv` package manager
- UniFi controller (Dream Machine, Cloud Key, etc.) OR UniFi Site Manager account
</file context>
| - Python 3.10 or higher | |
| - Python 3.12 or higher |
Summary
Changes
Dockerfile (Critical)
FROM node:20-alpinewithFROM python:3.12-alpineagent-card.json
protect_toggle_privacytoconfirmation_required(was only inreversible_operations)python>=3.12topython>=3.10for consistencyREADME.md
docker-build-push.yml
steps.meta.outputs.digesttosteps.build-push.outputs.digestTest plan
🐰 Found by CodeRabbit review
🤖 Generated with Claude Code
Summary by cubic
Rewrote the Dockerfile to run a Python app (Python 3.12 + uv) instead of Node so the image builds and starts correctly with a proper healthcheck. Aligned Python version to 3.10+ across docs/config and fixed a workflow digest reference.
Written for commit ea01573. Summary will update on new commits.
Summary by CodeRabbit
Updates
Chores