FROM python:3.9 # Set the TRANSFORMERS_CACHE environment variable ENV TRANSFORMERS_CACHE=/app/cache/huggingface/hub # Copy your app code COPY . /app WORKDIR /app # Install dependencies RUN pip install -r requirements.txt # Create the cache directory and set permissions RUN mkdir -p /app/cache/huggingface/hub && \ chmod -R 777 /app/cache # Create a non-root user and switch to it RUN useradd -m appuser USER appuser # Start the app CMD ["python", "app.py"]