openai-math-explorer / Dockerfile
mishig's picture
mishig HF Staff
Theorem Explorer: search UI + API for github.com/openai/math
c5ced83 verified
Raw History Blame Contribute Delete
1.21 kB
# Frontend: Svelte + Vite -> /static
FROM node:24-slim AS web
WORKDIR /web
RUN corepack enable
COPY frontend/package.json frontend/pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY frontend/ ./
RUN pnpm build
# API: FastAPI + Qwen3-Embedding-0.6B on CPU
FROM python:3.12-slim
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
HF_HOME=/home/user/.cache/huggingface \
PYTHONUNBUFFERED=1 \
TOKENIZERS_PARALLELISM=false
WORKDIR /home/user/app
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --user torch==2.14.1 --index-url https://download.pytorch.org/whl/cpu \
&& pip install --no-cache-dir --user -r requirements.txt
# Bake the model into the image so cold starts don't download it.
RUN python -c "from huggingface_hub import snapshot_download; \
snapshot_download('Qwen/Qwen3-Embedding-0.6B', revision='97b0c614be4d77ee51c0cef4e5f07c00f9eb65b3', \
allow_patterns=['*.json', '*.safetensors', '*.txt', '1_Pooling/*'])"
COPY --chown=user backend/ backend/
COPY --chown=user index/ index/
COPY --chown=user --from=web /static static/
EXPOSE 7860
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860"]