Hoe commited on
Commit
cd39ae9
·
1 Parent(s): 3221d82

Fix: run uvicorn as a python module

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -5
Dockerfile CHANGED
@@ -14,15 +14,18 @@ USER user
14
  # 4. Copy the project files
15
  COPY --chown=user . .
16
 
17
- # 5. Run the sync AND explicitly add uvicorn/fastapi
18
- # This ensures even if they are missing from pyproject.toml, they get installed
 
19
  RUN /usr/local/bin/uv sync --all-extras && \
20
- /usr/local/bin/uv add uvicorn fastapi
 
21
 
22
  # 6. Set Hugging Face environment
23
  ENV PORT=7860
24
  EXPOSE 7860
25
 
26
  # 7. Start the API
27
- # We use 'uv run' to ensure we are inside the virtualenv
28
- CMD ["/usr/local/bin/uv", "run", "python", "-m", "uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
14
  # 4. Copy the project files
15
  COPY --chown=user . .
16
 
17
+ # 5. Monorepo Installation
18
+ # We sync the root project, add the web server,
19
+ # and explicitly install the local 'duckdb_loader' package.
20
  RUN /usr/local/bin/uv sync --all-extras && \
21
+ /usr/local/bin/uv add uvicorn fastapi && \
22
+ /usr/local/bin/uv pip install -e ./duckdb_loader
23
 
24
  # 6. Set Hugging Face environment
25
  ENV PORT=7860
26
  EXPOSE 7860
27
 
28
  # 7. Start the API
29
+ # We update the module path to reflect the directory structure.
30
+ # This assumes your FastAPI 'app' is inside 'duckdb_loader/main.py'
31
+ CMD ["/usr/local/bin/uv", "run", "python", "-m", "uvicorn", "duckdb_loader.main:app", "--host", "0.0.0.0", "--port", "7860"]