Spaces:
Sleeping
Sleeping
File size: 748 Bytes
e4bbdd6 e3a5776 9fb7743 e3a5776 9fb7743 e3a5776 9fb7743 e3a5776 6fb5d9a e4bbdd6 e3a5776 e4bbdd6 9fb7743 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# Use Python 3.10 or later
FROM python:3.10
# Set the working directory
WORKDIR /app
# Set environment variables for Hugging Face
ENV HF_HOME=/huggingface
ENV TRANSFORMERS_CACHE=/huggingface/cache
ENV HF_HUB_ENABLE_HF_TRANSFER=1
ENV HF_HUB_CACHE_DIR=/huggingface/cache
# Create cache directories with appropriate permissions
RUN mkdir -p /huggingface/cache && \
chmod -R 777 /huggingface
# Copy only requirements first to leverage Docker cache
COPY requirements.txt .
RUN pip install -r requirements.txt
# Copy the rest of the application
COPY app.py .
# Create a volume for the cache
VOLUME ["/huggingface/cache"]
# Expose port for FastAPI
EXPOSE 7860
# Run FastAPI app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |