Skip to content

fix: Rewrite Dockerfile for Python and fix consistency issues - #3

Merged
ry-ops merged 1 commit into
mainfrom
fix/dockerfile-python
Feb 6, 2026
Merged

fix: Rewrite Dockerfile for Python and fix consistency issues#3
ry-ops merged 1 commit into
mainfrom
fix/dockerfile-python

Conversation

@ry-ops

@ry-ops ry-ops commented Feb 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • Critical: Dockerfile was configured for Node.js but project is Python-based
  • Fixed agent-card.json safety configuration inconsistency
  • Aligned Python version requirements across all files

Changes

Dockerfile (Critical)

  • Replaced FROM node:20-alpine with FROM python:3.12-alpine
  • Replaced npm/node commands with uv/python
  • Updated healthcheck and CMD for Python

agent-card.json

  • Added protect_toggle_privacy to confirmation_required (was only in reversible_operations)
  • Updated runtime requirement from python>=3.12 to python>=3.10 for consistency

README.md

  • Updated "Python 3.8 or higher" to "Python 3.10 or higher" to match badge

docker-build-push.yml

  • Fixed digest output reference from steps.meta.outputs.digest to steps.build-push.outputs.digest

Test plan

  • Verify Docker image builds successfully
  • Verify container starts and serves health endpoint
  • Verify agent-card.json is valid JSON

🐰 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.

  • Bug Fixes
    • Dockerfile: switch to python:3.12-alpine, install with uv, set PYTHONUNBUFFERED, use curl healthcheck, run main.py, and run as non-root.
    • agent-card.json: add protect_toggle_privacy to confirmation_required; set runtime to python>=3.10.
    • README: update Python requirement to 3.10+.
    • CI: fix docker-build-push digest output (meta → build-push).

Written for commit ea01573. Summary will update on new commits.

Summary by CodeRabbit

  • Updates

    • Migrated application runtime environment to Python
    • Updated minimum Python version requirements
    • Enhanced privacy protection confirmations in configuration
  • Chores

    • Updated Docker build workflow and container configuration
    • Adjusted healthcheck and startup processes

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>
@coderabbitai

coderabbitai Bot commented Feb 3, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This 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

Cohort / File(s) Summary
CI/CD Workflow
.github/workflows/docker-build-push.yml
Added build step identifier and updated image digest output reference from steps.meta.outputs.digest to steps.build-push.outputs.digest.
Docker Build Configuration
Dockerfile
Migrated base image from node:20-alpine to python:3.12-alpine. Replaced Node.js tooling (npm) with Python tooling (uv). Updated environment variables, healthcheck mechanism, and startup command from node index.js to python main.py.
Documentation & Configuration
README.md, agent-card.json
Updated minimum Python version requirement from 3.10 to 3.12 in README and adjusted runtime requirement in agent-card.json. Added protect_toggle_privacy to safety confirmation requirements.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 From nodes to snakes, our code takes flight,
Python paths now glowing bright,
Alpine mountains, dependencies lean,
The cleanest migration we've ever seen! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: Rewrite Dockerfile for Python and fix consistency issues' accurately describes the main changes: converting the Dockerfile from Node.js to Python and fixing related consistency issues across multiple files (agent-card.json, README.md, and workflow).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/dockerfile-python

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread Dockerfile
Comment on lines +13 to 23
# 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 . .

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Find the Dockerfile
find . -name "Dockerfile" -type f

Repository: ry-ops/unifi-mcp-server

Length of output: 79


🏁 Script executed:

# Examine the Dockerfile content
cat -n ./Dockerfile

Repository: 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.toml

Repository: ry-ops/unifi-mcp-server

Length of output: 388


🏁 Script executed:

# Check if README.md exists in the repository
ls -la README.md

Repository: 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.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread Dockerfile
COPY pyproject.toml ./

# Install dependencies
RUN uv pip install --system -e .

@cubic-dev-ai cubic-dev-ai Bot Feb 3, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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>
Fix with Cubic

Comment thread README.md
## Prerequisites

- Python 3.8 or higher
- Python 3.10 or higher

@cubic-dev-ai cubic-dev-ai Bot Feb 3, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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>
Suggested change
- Python 3.10 or higher
- Python 3.12 or higher
Fix with Cubic

@ry-ops
ry-ops merged commit 91bb6ac into main Feb 6, 2026
3 of 4 checks passed
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