carlynamazed24's picture
Update Dockerfile
c11ef93 verified
raw
history blame contribute delete
596 Bytes
FROM python:3.9-slim
# Set up working directory
WORKDIR /app
# Copy files
COPY requirements.txt .
COPY app.py .
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Create a writable cache directory and set permissions
RUN mkdir -p /app/cache && chmod 777 /app/cache
# Set environment variables
ENV HF_HOME=/app/cache
ENV HF_DATASETS_CACHE=/app/cache
ENV HUGGINGFACE_HUB_CACHE=/app/cache
ENV XDG_CACHE_HOME=/app/cache
# Expose the FastAPI port
EXPOSE 7860
# Run the FastAPI server
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--root-path", "/"]