litellm-proxy / Dockerfile
raheem786's picture
Upload folder using huggingface_hub
badfd30 verified
raw
history blame contribute delete
847 Bytes
FROM python:3.11-slim
# Create a non-root user (UID 1000 is required by Hugging Face)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
ENV PYTHONPATH=/home/user/app
# Install LiteLLM
RUN pip install --no-cache-dir --upgrade 'litellm[proxy]'
# Copy your config with correct ownership (source: litellm-config-auto.yaml → config.yaml)
COPY --chown=user litellm-config-auto.yaml config.yaml
# Copy trim-messages hook so proxy can cap input token usage
COPY --chown=user trim_messages_hook.py trim_messages_hook.py
# MUST use port 7860 for Hugging Face; Render sets PORT at runtime
EXPOSE 7860
# PORT from env (Render); default 7860 for Hugging Face Spaces
ENTRYPOINT ["/bin/sh", "-c"]
CMD ["exec litellm --config /home/user/app/config.yaml --port ${PORT:-7860} --host 0.0.0.0"]