arikatokachi commited on
Commit
7f3ebd6
Β·
verified Β·
1 Parent(s): 3a9bea9

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +3 -15
Dockerfile CHANGED
@@ -1,4 +1,3 @@
1
-
2
  ARG BASE_IMAGE=ghcr.io/meta-pytorch/openenv-base:latest
3
  FROM ${BASE_IMAGE} AS builder
4
 
@@ -36,30 +35,19 @@ RUN --mount=type=cache,target=/root/.cache/uv \
36
  uv sync --no-editable; \
37
  fi
38
 
39
- # ── BAKE BGE MODEL INTO IMAGE ─────────────────────────────────
40
- # This runs during build so the model is IN the image
41
- # No download needed at runtime β€” critical for 20min limit
42
- # RUN /app/env/.venv/bin/python -c "from fastembed import TextEmbedding; print('Downloading BGE model...'); model = TextEmbedding('BAAI/bge-small-en-v1.5'); list(model.embed(['test'])); print('BGE model baked into image successfully')"
43
- # RUN mkdir -p /root/.cache/fastembed
44
-
45
  # ── Final runtime stage ───────────────────────────────────────
46
  FROM ${BASE_IMAGE}
47
 
48
  WORKDIR /app
49
 
50
- # copy venv with BGE model already inside
51
  COPY --from=builder /app/env/.venv /app/.venv
52
-
53
- # copy environment code
54
  COPY --from=builder /app/env /app/env
55
 
56
  ENV PATH="/app/.venv/bin:$PATH"
57
  ENV PYTHONPATH="/app/env:$PYTHONPATH"
58
 
59
- # BGE model cache location β€” fastembed stores here by default
60
- # copy from builder so it's available at runtime
61
- COPY --from=builder /root/.cache/huggingface /root/.cache/huggingface
62
- COPY --from=builder /root/.cache/fastembed /root/.cache/fastembed
63
 
64
  HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
65
  CMD curl -f http://localhost:8000/health || exit 1
@@ -67,4 +55,4 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
67
  EXPOSE 8000
68
 
69
  ENV ENABLE_WEB_INTERFACE=true
70
- CMD ["sh", "-c", "cd /app/env && uvicorn server.app:app --host 0.0.0.0 --port 8000"]
 
 
1
  ARG BASE_IMAGE=ghcr.io/meta-pytorch/openenv-base:latest
2
  FROM ${BASE_IMAGE} AS builder
3
 
 
35
  uv sync --no-editable; \
36
  fi
37
 
 
 
 
 
 
 
38
  # ── Final runtime stage ───────────────────────────────────────
39
  FROM ${BASE_IMAGE}
40
 
41
  WORKDIR /app
42
 
 
43
  COPY --from=builder /app/env/.venv /app/.venv
 
 
44
  COPY --from=builder /app/env /app/env
45
 
46
  ENV PATH="/app/.venv/bin:$PATH"
47
  ENV PYTHONPATH="/app/env:$PYTHONPATH"
48
 
49
+ # HF_TOKEN must be injected at runtime via your deployment platform's secret/env config
50
+ # e.g. docker run -e HF_TOKEN=hf_xxx ...
 
 
51
 
52
  HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
53
  CMD curl -f http://localhost:8000/health || exit 1
 
55
  EXPOSE 8000
56
 
57
  ENV ENABLE_WEB_INTERFACE=true
58
+ CMD ["sh", "-c", "cd /app/env && uvicorn server.app:app --host 0.0.0.0 --port 8000"]