Update Dockerfile
Browse files- 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
|
| 21 |
|
| 22 |
-
# Add /code/backend to PYTHONPATH to ensure backend_app can be imported
|
| 23 |
-
# whether
|
| 24 |
-
ENV PYTHONPATH="
|
| 25 |
|
| 26 |
-
# Command to run the application using uvicorn
|
| 27 |
-
#
|
| 28 |
-
CMD ["
|
|
|
|
| 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"]
|