-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
65 lines (53 loc) · 3.73 KB
/
Copy pathDockerfile
File metadata and controls
65 lines (53 loc) · 3.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# syntax=docker/dockerfile:1.7
# Self-contained, inference-only ModelSearch demo image.
# Build with ./scripts/build_demo_image.sh so the two external data contexts exist.
FROM python:3.12-slim-trixie
RUN apt-get update \
&& apt-get install -y --no-install-recommends openjdk-21-jre-headless libgomp1 curl gcc libc6-dev \
&& rm -rf /var/lib/apt/lists/*
RUN useradd --create-home --uid 1000 modelsearch
WORKDIR /app
COPY requirements-demo.txt /tmp/requirements-demo.txt
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cpu torch \
&& CFLAGS=-Wno-error=incompatible-pointer-types pip install --no-cache-dir -r /tmp/requirements-demo.txt \
&& rm /tmp/requirements-demo.txt
# Minimal prebuilt inference artifacts from this repository.
COPY --chown=modelsearch:modelsearch data_251117/card2card_embeddings_hugging.npz ./runtime/indexes/card2card_embeddings_hugging.npz
COPY --chown=modelsearch:modelsearch data_251117/card2card_sparse_index_hugging ./runtime/indexes/card2card_sparse_index_hugging
COPY --chown=modelsearch:modelsearch data_251117/model_to_tables_explode_v2_251117.parquet ./runtime/indexes/model_to_tables_explode_v2_251117.parquet
COPY --chown=modelsearch:modelsearch data_251117/valid_model_ids_with_tables_hugging.txt ./runtime/indexes/valid_model_ids_with_tables_hugging.txt
COPY --chown=modelsearch:modelsearch data_251117/card2nugget ./runtime/indexes/card2nugget
# Minimal external ModelTables/Blend data, supplied as named BuildKit contexts.
COPY --from=modeltables --chown=modelsearch:modelsearch data/processed/deduped_hugging_csvs_v2_251117 ./runtime/modeltables/processed/deduped_hugging_csvs_v2_251117
COPY --from=modeltables --chown=modelsearch:modelsearch data/raw_251117 ./runtime/modeltables/raw_251117
COPY --from=blend --chown=modelsearch:modelsearch database_251117/modellake_v2_251117_nomask_hugging.db ./runtime/modellake_v2_251117_nomask_hugging.db
# Bake the encoder weights into the image so first launch works offline.
ENV HF_HOME=/app/runtime/huggingface-cache
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"
# Application code is intentionally copied after the large stable data layers,
# so UI/code-only changes rebuild quickly. Integration needs bundled ALITE plus
# a very small query-time slice of Blend.
COPY --chown=modelsearch:modelsearch src ./src
COPY --chown=modelsearch:modelsearch others/alite_internal ./others/alite_internal
COPY --chown=modelsearch:modelsearch docs/pipeline1.png ./docs/pipeline1.png
COPY --chown=modelsearch:modelsearch docs/pipeline2.png ./docs/pipeline2.png
COPY --chown=modelsearch:modelsearch docs/pipeline3.png ./docs/pipeline3.png
COPY --from=blend --chown=modelsearch:modelsearch scripts/table_searcher.py ./others/Blend_internal/scripts/table_searcher.py
COPY --from=blend --chown=modelsearch:modelsearch scripts/__init__.py ./others/Blend_internal/scripts/__init__.py
COPY --from=blend --chown=modelsearch:modelsearch src/utils.py ./others/Blend_internal/src/utils.py
COPY --chown=modelsearch:modelsearch scripts/docker-entrypoint.sh ./scripts/docker-entrypoint.sh
RUN mkdir -p /app/jobs /app/tmp && chown modelsearch:modelsearch /app/jobs /app/tmp
USER modelsearch
ENV PYTHONUNBUFFERED=1 \
MODELSEARCH_HUGGING_ONLY=1 \
MODELTABLES_DATA=/app/runtime/modeltables \
MODELSEARCH_DATA_DIR=/app/runtime/indexes \
MODELSEARCH_JOBS_DIR=/app/jobs \
MODELLAKE_DB_HUGGING=/app/runtime/modellake_v2_251117_nomask_hugging.db \
PORT=5002
EXPOSE 5001
VOLUME ["/app/jobs"]
HEALTHCHECK --interval=30s --timeout=5s --start-period=120s --retries=3 \
CMD curl -fsS http://127.0.0.1:5001/api/health || exit 1
ENTRYPOINT ["/app/scripts/docker-entrypoint.sh"]