Spaces:
Running
Running
| # Linuswise backend for a Hugging Face Space (Docker SDK). | |
| # Built and run by HF; the public URL is routed to app_port (8765, see README.md). | |
| FROM python:3.12-slim | |
| # tzdata so the server's local time (date.today()/datetime.now()) is the user's, | |
| # which sets the daily-batch rollover and the morning-email time. Override TZ with | |
| # a Space "Variable" named TZ (e.g. Australia/Melbourne). | |
| RUN apt-get update && apt-get install -y --no-install-recommends tzdata \ | |
| && rm -rf /var/lib/apt/lists/* | |
| ENV PYTHONUNBUFFERED=1 \ | |
| TZ=America/Los_Angeles \ | |
| HF_HOME=/app/hf_cache \ | |
| LINUSWISE_WEB_HOST=0.0.0.0 \ | |
| LINUSWISE_CONFIG=/app/space.config.toml | |
| WORKDIR /app | |
| # numpy / pymupdf / tokenizers all ship manylinux x86_64 wheels (HF Spaces arch), | |
| # so this installs without a compiler. | |
| COPY pyproject.toml README.md LICENSE ./ | |
| COPY linuswise ./linuswise | |
| RUN pip install --no-cache-dir . "huggingface_hub>=0.23" | |
| # Bake the embedding model into the image so Ask is instant on a cold start. | |
| RUN python -c "from model2vec import StaticModel; StaticModel.from_pretrained('minishlab/potion-base-8M')" | |
| COPY space.config.toml ./space.config.toml | |
| # Writable dirs regardless of the runtime UID HF assigns. | |
| RUN mkdir -p /app/data && chmod -R 777 /app/data /app/hf_cache | |
| EXPOSE 8765 | |
| CMD ["linuswise", "serve", "--no-browser"] | |