# Use the official Python image FROM python:3.9 # Set the working directory WORKDIR /code # Copy the requirements file COPY ./requirements.txt /code/requirements.txt # Install the dependencies RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # Copy the application code COPY ./app.py /code/app.py # Create a writable cache directory (FastAPI/Uvicorn needs this sometimes) RUN mkdir -p /code/cache RUN chmod 777 /code/cache ENV XDG_CACHE_HOME=/code/cache # Start the application on port 7860 (Hugging Face's default port) CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]