Skip to content

Commit 3ee0566

Browse files
committed
ci: enable deployment on huggingface spaces
1 parent eb421a2 commit 3ee0566

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ ENV SPARQL_FILE='/app/fetch_rhea.rq'
2020
# SPARQL endpoint to fetch compounds from
2121
ENV SPARQL_ENDPOINT='https://sparql.rhea-db.org/sparql'
2222

23+
# Precompute fingerprints from the bundled compounds.tsv so the server starts
24+
# fast (no recompute on cold start). The cache is keyed on file content + fp
25+
# types, so the runtime entrypoint below reuses it directly.
26+
RUN uv run python -c "from mol_search_sparql_service.rdkit_fingerprints import engine; engine.load_file('compounds.tsv', cache_dir='.mol-search-service')"
27+
28+
# Run as a non-root user (Hugging Face Spaces convention). Give it ownership of
29+
# /app so the precomputed cache and venv remain readable/writable at runtime.
30+
RUN useradd -m -u 1000 user && chown -R user:user /app
31+
USER user
32+
ENV HOME=/home/user
33+
2334
EXPOSE 8010
2435
ENTRYPOINT ["sh", "-c", "uv run mol-search-sparql-service -f compounds.tsv -p $SERVER_PORT -w $WORKERS"]
2536
# ENTRYPOINT ["sh", "-c", "uv run mol-search-sparql-service -s fetch_rhea.rq -e https://sparql.rhea-db.org/sparql -p $SERVER_PORT -w $WORKERS"]

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
---
2+
title: Chemistry Search SPARQL Service
3+
emoji: 🫆
4+
colorFrom: indigo
5+
colorTo: blue
6+
sdk: docker
7+
app_port: 8010
8+
pinned: false
9+
---
10+
111
# 🫆 Chemistry Search SPARQL Service
212

313
A service for finding similar chemicals and substructures using molecular fingerprints. It provides both a SPARQL endpoint and an MCP (Model Context Protocol) server interface.

0 commit comments

Comments
 (0)