Spaces:
Sleeping
Sleeping
| # Fast Space image: prebuilt SPA + prebuilt mmap index (no Node, no Kaikki parse). | |
| # Index is fetched from the published HF dataset artifact during image build. | |
| FROM python:3.12-slim-bookworm | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PYTHONPATH=/app \ | |
| PORT=7860 \ | |
| MALLOC_ARENA_MAX=2 | |
| WORKDIR /app | |
| RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl zstd \ | |
| && rm -rf /var/lib/apt/lists/* | |
| COPY requirements.space.txt ./requirements.txt | |
| RUN pip install --no-cache-dir -r requirements.txt \ | |
| && find /usr/local -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true | |
| COPY backend ./backend | |
| COPY scripts/space_entrypoint.sh ./scripts/space_entrypoint.sh | |
| RUN chmod +x ./scripts/space_entrypoint.sh | |
| # Prebuilt Vite output (built on the deploy host; keeps image builds off Node). | |
| COPY frontend/dist ./frontend/dist | |
| # Pinned prebuilt index artifact (update when republishing the dataset). | |
| ARG INDEX_URL=https://huggingface.co/datasets/Mongoosetross/reverse-etymology-index/resolve/main/index.tar.zst | |
| ARG INDEX_SHA256=51f60c37cb3219268f7852363860f7d17650cf2079888de75573f28412bb6d71 | |
| RUN mkdir -p data/index \ | |
| && curl -fsSL "$INDEX_URL" -o /tmp/index.tar.zst \ | |
| && if [ -n "$INDEX_SHA256" ]; then echo "$INDEX_SHA256 /tmp/index.tar.zst" | sha256sum -c -; fi \ | |
| && tar -I zstd -xf /tmp/index.tar.zst -C data/index \ | |
| && rm -f /tmp/index.tar.zst \ | |
| && test -f data/index/atlas.sqlite \ | |
| && test -f data/index/mmap/rev_off.i32 | |
| EXPOSE 7860 | |
| CMD ["./scripts/space_entrypoint.sh"] | |