# Use Python 3.9 FROM python:3.9 # Set working directory to /code WORKDIR /code # Copy requirements and install them COPY ./requirements.txt /code/requirements.txt RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # Create a non-root user (Security requirement for HF Spaces) RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Copy the rest of the application files COPY --chown=user . /code # Run the application CMD ["python", "app.py"]