RishiXD commited on
Commit
493f2cf
·
verified ·
1 Parent(s): 09575c2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -8
Dockerfile CHANGED
@@ -16,13 +16,13 @@ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
16
  # Copy project including `backend_app` directory
17
  COPY . /code/
18
 
19
- # Expose the API port
20
- EXPOSE 5000
21
 
22
- # Add /code/backend to PYTHONPATH to ensure backend_app can be imported
23
- # whether building from root or backend directory
24
- ENV PYTHONPATH="${PYTHONPATH}:/code/backend"
25
 
26
- # Command to run the application using uvicorn correctly
27
- # This runs from /code, so references use 'backend_app.main:app'
28
- CMD ["uvicorn", "backend_app.main:app", "--host", "0.0.0.0", "--port", "5000"]
 
16
  # Copy project including `backend_app` directory
17
  COPY . /code/
18
 
19
+ # Expose the API port (Hugging Face Spaces defaults to 7860)
20
+ EXPOSE 7860
21
 
22
+ # Add both /code and /code/backend to PYTHONPATH to ensure backend_app can be imported
23
+ # regardless of whether the build context was root or the backend folder.
24
+ ENV PYTHONPATH="/code:/code/backend:$PYTHONPATH"
25
 
26
+ # Command to run the application using uvicorn.
27
+ # We use 'sh -c' to inspect the directory structure before starting, which helps debug 'ModuleNotFoundError'.
28
+ CMD ["sh", "-c", "ls -R /code && uvicorn backend_app.main:app --host 0.0.0.0 --port 7860"]