# Lightweight: no CUDA base and no ML dependencies. All generation happens in # the inference Space; this container just serves the interface. FROM python:3.11-slim ENV PYTHONUNBUFFERED=1 \ PIP_NO_CACHE_DIR=1 # Spaces run as uid 1000 and only $HOME is writable. RUN useradd -m -u 1000 app USER app ENV HOME=/home/app \ HF_HOME=/home/app/.cache/huggingface \ PATH=/home/app/.local/bin:$PATH WORKDIR /home/app COPY --chown=app requirements.txt . RUN pip install --user --no-cache-dir -r requirements.txt COPY --chown=app app.py ./ EXPOSE 7860 ENV PORT=7860 CMD ["python", "app.py"]