Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +6 -5
Dockerfile
CHANGED
|
@@ -1,26 +1,27 @@
|
|
| 1 |
# Dockerfile
|
|
|
|
| 2 |
# Use an official Python runtime as a parent image
|
| 3 |
FROM python:3.9
|
| 4 |
|
| 5 |
# Set the working directory in the container
|
| 6 |
WORKDIR /app
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
# Copy the requirements file into the container
|
| 9 |
COPY requirements.txt .
|
| 10 |
|
| 11 |
# Install any needed packages specified in requirements.txt
|
| 12 |
-
# --no-cache-dir ensures the image is smaller
|
| 13 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 14 |
|
| 15 |
# Copy the rest of your application code into the container
|
| 16 |
COPY . .
|
| 17 |
|
| 18 |
# Make port 7860 available to the world outside this container
|
| 19 |
-
# Hugging Face Spaces requires port 7860
|
| 20 |
EXPOSE 7860
|
| 21 |
|
| 22 |
-
# Define environment variables if needed (FLASK_APP is not strictly needed with gunicorn CMD)
|
| 23 |
-
# ENV FLASK_APP=app.py
|
| 24 |
-
|
| 25 |
# Command to run your application using gunicorn with eventlet for SocketIO
|
| 26 |
CMD ["gunicorn", "--worker-class", "eventlet", "--bind", "0.0.0.0:7860", "app.app:app"]
|
|
|
|
| 1 |
# Dockerfile
|
| 2 |
+
|
| 3 |
# Use an official Python runtime as a parent image
|
| 4 |
FROM python:3.9
|
| 5 |
|
| 6 |
# Set the working directory in the container
|
| 7 |
WORKDIR /app
|
| 8 |
|
| 9 |
+
# --- FIX: Set a writable cache directory for Hugging Face models ---
|
| 10 |
+
ENV HF_HOME=/app/cache
|
| 11 |
+
ENV TRANSFORMERS_CACHE=/app/cache
|
| 12 |
+
# We set both, HF_HOME is the new standard, TRANSFORMERS_CACHE is for older versions.
|
| 13 |
+
|
| 14 |
# Copy the requirements file into the container
|
| 15 |
COPY requirements.txt .
|
| 16 |
|
| 17 |
# Install any needed packages specified in requirements.txt
|
|
|
|
| 18 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 19 |
|
| 20 |
# Copy the rest of your application code into the container
|
| 21 |
COPY . .
|
| 22 |
|
| 23 |
# Make port 7860 available to the world outside this container
|
|
|
|
| 24 |
EXPOSE 7860
|
| 25 |
|
|
|
|
|
|
|
|
|
|
| 26 |
# Command to run your application using gunicorn with eventlet for SocketIO
|
| 27 |
CMD ["gunicorn", "--worker-class", "eventlet", "--bind", "0.0.0.0:7860", "app.app:app"]
|