FROM python:3.9-slim WORKDIR /code # Create cache directory with proper permissions RUN mkdir -p /cache ENV TRANSFORMERS_CACHE=/cache ENV HF_HOME=/cache RUN chmod 777 /cache COPY ./requirements.txt /code/requirements.txt RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt COPY . /code # Make directory for uploads RUN mkdir -p /code/uploads RUN chmod 777 /code/uploads # Expose the port EXPOSE 7860 # Add a health check to ensure the server is running HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ CMD curl -f http://localhost:7860/health || exit 1 # Command to run the application CMD ["python", "app.py"]