tower-learns-you / Dockerfile
vknt's picture
Route AI through HF Inference router (tool-calling agent)
39e4a24 verified
Raw
History Blame Contribute Delete
984 Bytes
# Hugging Face Docker Space — The Tower Learns You (gr.Server custom frontend).
# The Space serves server_app.py on port 7860. Real AI runs the tool-calling
# agent against HF Inference Providers' OpenAI-compatible router when an HF_TOKEN
# secret is set; otherwise it falls back to deterministic content, so the Space
# is always playable.
FROM python:3.12-slim
# Run as the non-root user Hugging Face Spaces expects (uid 1000).
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONUNBUFFERED=1 \
PORT=7860 \
SERVER_NAME=0.0.0.0 \
MODEL_BACKEND=local_openai \
LOCAL_OPENAI_URL=https://router.huggingface.co/v1 \
LOCAL_MODEL_ALIAS=Qwen/Qwen3-4B-Instruct-2507
WORKDIR /home/user/app
COPY --chown=user requirements-server.txt .
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements-server.txt
COPY --chown=user . .
EXPOSE 7860
CMD ["python", "server_app.py"]