Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +8 -3
Dockerfile
CHANGED
|
@@ -1,10 +1,15 @@
|
|
| 1 |
-
|
| 2 |
# Use an official Python runtime as the base image
|
| 3 |
FROM python:3.9-slim
|
| 4 |
|
| 5 |
# Set working directory
|
| 6 |
WORKDIR /app
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
# Copy requirements file
|
| 9 |
COPY requirements.txt .
|
| 10 |
|
|
@@ -14,8 +19,8 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
| 14 |
# Copy the FastAPI application code
|
| 15 |
COPY main.py .
|
| 16 |
|
| 17 |
-
# Expose port
|
| 18 |
EXPOSE 7860
|
| 19 |
|
| 20 |
# Command to run the application with Uvicorn
|
| 21 |
-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
|
| 1 |
# Use an official Python runtime as the base image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Create a cache directory and set permissions
|
| 8 |
+
RUN mkdir -p /app/cache && chmod -R 777 /app/cache
|
| 9 |
+
|
| 10 |
+
# Set environment variable for Hugging Face cache
|
| 11 |
+
ENV TRANSFORMERS_CACHE=/app/cache
|
| 12 |
+
|
| 13 |
# Copy requirements file
|
| 14 |
COPY requirements.txt .
|
| 15 |
|
|
|
|
| 19 |
# Copy the FastAPI application code
|
| 20 |
COPY main.py .
|
| 21 |
|
| 22 |
+
# Expose port 7860 for the FastAPI app
|
| 23 |
EXPOSE 7860
|
| 24 |
|
| 25 |
# Command to run the application with Uvicorn
|
| 26 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|