Spaces:
Sleeping
Sleeping
Muhammed Sameer commited on
Commit ·
1a799bc
1
Parent(s): efb9c07
Add Dockerfile for Hugging Face deployment
Browse files- Dockerfile +23 -0
Dockerfile
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.10
|
| 2 |
+
|
| 3 |
+
# Set the working directory to the root of the project
|
| 4 |
+
WORKDIR /code
|
| 5 |
+
|
| 6 |
+
# Copy requirements and install them globally
|
| 7 |
+
COPY backend/requirements.txt /code/requirements.txt
|
| 8 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 9 |
+
|
| 10 |
+
# Download NLTK data during the build step so it doesn't slow down startup
|
| 11 |
+
RUN python -m nltk.downloader stopwords punkt punkt_tab wordnet
|
| 12 |
+
|
| 13 |
+
# Copy the entire backend directory into the container
|
| 14 |
+
COPY backend /code/backend
|
| 15 |
+
|
| 16 |
+
# Set the working directory to backend so uvicorn can find api.py correctly
|
| 17 |
+
WORKDIR /code/backend
|
| 18 |
+
|
| 19 |
+
# Hugging Face Spaces requires the app to listen on port 7860
|
| 20 |
+
EXPOSE 7860
|
| 21 |
+
|
| 22 |
+
# Start the FastAPI app on port 7860
|
| 23 |
+
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"]
|