FROM python:3.9 # Set work directory WORKDIR /code # Install dependencies COPY ./requirements.txt /code/requirements.txt RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # Copy application code COPY ./app /code/app # Create and set permissions for the cache directory RUN mkdir -p /code/app/cache && chmod -R 777 /code/app/cache # Set environment variable for Transformers cache ENV TRANSFORMERS_CACHE=/code/app/cache # Expose port EXPOSE 7860 # Start application CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]