Skip to content

fix: add PYTHONPATH to docker-compose for pre-built images - #77

Merged
debpalash merged 1 commit into
debpalash:mainfrom
fishandsheep:fix/docker-compose-pythonpath
May 18, 2026
Merged

fix: add PYTHONPATH to docker-compose for pre-built images#77
debpalash merged 1 commit into
debpalash:mainfrom
fishandsheep:fix/docker-compose-pythonpath

Conversation

@fishandsheep

@fishandsheep fishandsheep commented May 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add PYTHONPATH=/app/backend to both CPU and GPU service definitions in deploy/docker-compose.yml

Problem

The pre-built GHCR image (ghcr.io/debpalash/omnivoice-studio:latest) was published before the sys.path fix in backend/main.py (lines 8–10) was added. When docker compose up starts the container, uvicorn resolves backend.main:app successfully, but the module-level import at line 144:

from core.config import (

fails with ModuleNotFoundError: No module named 'core', causing the container to crash-loop on startup.

The Dockerfile already sets ENV PYTHONPATH=/app/backend, but the pre-built image on GHCR predates that line — the environment variable is absent from the published image (confirmed via docker inspect).

Fix

Explicitly set PYTHONPATH=/app/backend in docker-compose.yml for both omnivoice (CPU) and omnivoice-gpu services. This works regardless of whether the image was built before or after the PYTHONPATH/sys.path fixes.

Test plan

  • docker compose -f deploy/docker-compose.yml up -d — container starts and reaches healthy status
  • docker compose -f deploy/docker-compose.yml --profile gpu up -d — GPU variant also has the fix
  • Verified container no longer crash-loops; /health endpoint returns 200

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated Docker deployment environment so containerized services correctly locate the application backend at runtime: PYTHONPATH is set for both CPU and GPU service configurations, alongside existing runtime data and model settings, improving consistency of Python module resolution within deployed containers.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 17, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6126eb7f-3efb-41ba-9d99-1be4b312787b

📥 Commits

Reviewing files that changed from the base of the PR and between b9399ee and 4bb721f.

📒 Files selected for processing (1)
  • deploy/docker-compose.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • deploy/docker-compose.yml

📝 Walkthrough

Walkthrough

The Docker Compose file now sets PYTHONPATH=/app/backend in the environment of both the CPU (omnivoice) and GPU (omnivoice-gpu) services so Python can resolve modules from /app/backend inside containers.

Changes

Docker Environment Setup

Layer / File(s) Summary
PYTHONPATH configuration for CPU and GPU services
deploy/docker-compose.yml
PYTHONPATH=/app/backend is added to the environment sections for both omnivoice and omnivoice-gpu.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A path for Python, snug and neat,
Set in both containers, a small repeat,
/app/backend now guides the way,
Imports find home, come what may,
Quietly hopping to save the day.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description is comprehensive with summary, problem statement, fix, and test plan. However, it does not follow the template's structure with explicit sections like Changes, Type, Checklist, and required checkboxes. While the description contains all necessary information, consider reformatting to match the repository template with explicit Type checkbox (appears to be a 🔧 CI/Build or 🐛 Bug fix), Testing section, and completed Checklist items.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding PYTHONPATH to docker-compose for pre-built images, which is the core objective of the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

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

The pre-built GHCR image was built before the sys.path fix in
backend/main.py (lines 8-10) was added. Without PYTHONPATH=/app/backend,
uvicorn resolves backend.main:app but the module-level `from core.config
import ...` at line 144 fails with ModuleNotFoundError: No module named
'core'. This causes the container to crash-loop on startup.

Add PYTHONPATH=/app/backend to both CPU and GPU service definitions so
that bare imports work regardless of which image version is pulled.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@debpalash
debpalash force-pushed the fix/docker-compose-pythonpath branch from b9399ee to 4bb721f Compare May 18, 2026 10:52
debpalash added a commit that referenced this pull request May 18, 2026
…nslate cuDNN sub-repo (#74)

Docker GPU support hardening + documentation.

- Restores docker compose --profile gpu up path; documents NVIDIA Container Toolkit setup in README
- Splits CPU vs GPU compose services cleanly (deploy/docker-compose.yml)
- backend/api/routers/setup/wizard.py: GPU detection in containerized environments uses torch.cuda fallback
- New scripts/setup.py replaces deleted scripts/setup_cudnn.py
- New test: tests/test_setup_preflight.py
- CHANGELOG.md + README.md updated

Complementary to PR #77 (community PYTHONPATH fix) — different sections of docker-compose.yml.
@debpalash
debpalash merged commit 6fd9b13 into debpalash:main May 18, 2026
8 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.

2 participants