Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +21 -17
Dockerfile
CHANGED
|
@@ -1,18 +1,22 @@
|
|
| 1 |
-
# Use an official Python runtime as a parent image
|
| 2 |
-
FROM python:3.10-slim
|
| 3 |
-
|
| 4 |
-
# Set the working directory
|
| 5 |
-
WORKDIR /code
|
| 6 |
-
|
| 7 |
-
#
|
| 8 |
-
|
| 9 |
-
RUN
|
| 10 |
-
|
| 11 |
-
# Copy
|
| 12 |
-
COPY . .
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Set the working directory
|
| 5 |
+
WORKDIR /code
|
| 6 |
+
|
| 7 |
+
# Set Hugging Face cache directory to a writable location
|
| 8 |
+
ENV HF_HOME=/data
|
| 9 |
+
RUN mkdir -p /data
|
| 10 |
+
|
| 11 |
+
# Copy requirements and install
|
| 12 |
+
COPY requirements.txt .
|
| 13 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 14 |
+
|
| 15 |
+
# Copy the rest of your code
|
| 16 |
+
COPY . .
|
| 17 |
+
|
| 18 |
+
# Expose port 7860 (the default for Spaces)
|
| 19 |
+
EXPOSE 7860
|
| 20 |
+
|
| 21 |
+
# Run the FastAPI app with uvicorn
|
| 22 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|