FROM python:3.9 WORKDIR /code # Copy requirements and install COPY ./api_requirements.txt /code/requirements.txt RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # Install Gunicorn RUN pip install gunicorn # Copy the application code COPY ./flask_api.py /code/flask_api.py # Create a writable directory for cache (transformers needs this) RUN mkdir -p /code/cache ENV TRANSFORMERS_CACHE=/code/cache RUN chmod 777 /code/cache # Start the application CMD ["gunicorn", "-b", "0.0.0.0:7860", "flask_api:app"]