ccheney commited on
Commit
c5ac7ca
·
verified ·
1 Parent(s): dfe67f1

Upload folder using huggingface_hub

Browse files
Dockerfile CHANGED
@@ -12,26 +12,20 @@
12
  # =============================================================================
13
 
14
  # -----------------------------------------------------------------------------
15
- # Single stage build with CUDA support (needed for onnxruntime-node-gpu)
16
  # -----------------------------------------------------------------------------
17
- FROM nvidia/cuda:12.3.2-cudnn9-devel-ubuntu22.04
18
 
19
- # Install Node.js 22 LTS and build dependencies
 
 
20
  RUN apt-get update && apt-get install -y \
21
- curl \
22
- ca-certificates \
23
- wget \
24
- jq \
25
  python3 \
26
  make \
27
  g++ \
28
  git \
29
- && curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
30
- && apt-get install -y nodejs \
31
  && rm -rf /var/lib/apt/lists/*
32
 
33
- WORKDIR /app
34
-
35
  # Copy monorepo package files
36
  COPY package*.json ./
37
  COPY packages/benchmark/package.json packages/benchmark/
@@ -42,21 +36,41 @@ COPY packages/logger/package.json packages/logger/
42
  COPY packages/common/package.json packages/common/
43
  COPY packages/temporal/package.json packages/temporal/
44
 
45
- # Install all dependencies with GPU support
46
  RUN npm install --include=dev
47
 
48
  # Copy source code
49
  COPY packages/ packages/
50
  COPY biome.json ./
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  # Model cache directory
53
  ENV HF_HOME=/app/.cache
54
  ENV TRANSFORMERS_CACHE=/app/.cache
55
  ENV XDG_CACHE_HOME=/app/.cache
56
 
57
  # Create cache directory for models (downloaded on first run)
58
- # Skipping model preload during Docker build to avoid build failures
59
- # Models will be cached after first run
60
  RUN mkdir -p /app/.cache
61
 
62
  # Install Qdrant for local vector search
@@ -93,7 +107,7 @@ ENV NODE_ENV=production
93
  ENV BENCHMARK_VERBOSE=true
94
  ENV NODE_OPTIONS="--max-old-space-size=24576"
95
 
96
- # GPU mode with FP16 for L4
97
  ENV EMBEDDER_DEVICE=cuda
98
  ENV EMBEDDER_DTYPE=fp16
99
  ENV QDRANT_URL=http://localhost:6333
 
12
  # =============================================================================
13
 
14
  # -----------------------------------------------------------------------------
15
+ # Stage 1: Build dependencies
16
  # -----------------------------------------------------------------------------
17
+ FROM node:22-bookworm-slim AS builder
18
 
19
+ WORKDIR /app
20
+
21
+ # Install build essentials for native modules
22
  RUN apt-get update && apt-get install -y \
 
 
 
 
23
  python3 \
24
  make \
25
  g++ \
26
  git \
 
 
27
  && rm -rf /var/lib/apt/lists/*
28
 
 
 
29
  # Copy monorepo package files
30
  COPY package*.json ./
31
  COPY packages/benchmark/package.json packages/benchmark/
 
36
  COPY packages/common/package.json packages/common/
37
  COPY packages/temporal/package.json packages/temporal/
38
 
39
+ # Install all dependencies
40
  RUN npm install --include=dev
41
 
42
  # Copy source code
43
  COPY packages/ packages/
44
  COPY biome.json ./
45
 
46
+ # -----------------------------------------------------------------------------
47
+ # Stage 2: Runtime image with CUDA support
48
+ # -----------------------------------------------------------------------------
49
+ FROM nvidia/cuda:12.3.2-cudnn9-runtime-ubuntu22.04
50
+
51
+ # Install Node.js 22 LTS and system dependencies
52
+ RUN apt-get update && apt-get install -y \
53
+ curl \
54
+ ca-certificates \
55
+ wget \
56
+ jq \
57
+ && curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
58
+ && apt-get install -y nodejs \
59
+ && rm -rf /var/lib/apt/lists/*
60
+
61
+ WORKDIR /app
62
+
63
+ # Copy built application from builder
64
+ COPY --from=builder /app/node_modules ./node_modules
65
+ COPY --from=builder /app/packages ./packages
66
+ COPY --from=builder /app/package*.json ./
67
+
68
  # Model cache directory
69
  ENV HF_HOME=/app/.cache
70
  ENV TRANSFORMERS_CACHE=/app/.cache
71
  ENV XDG_CACHE_HOME=/app/.cache
72
 
73
  # Create cache directory for models (downloaded on first run)
 
 
74
  RUN mkdir -p /app/.cache
75
 
76
  # Install Qdrant for local vector search
 
107
  ENV BENCHMARK_VERBOSE=true
108
  ENV NODE_OPTIONS="--max-old-space-size=24576"
109
 
110
+ # GPU mode with FP16 for L4 (onnxruntime-node auto-detects CUDA)
111
  ENV EMBEDDER_DEVICE=cuda
112
  ENV EMBEDDER_DTYPE=fp16
113
  ENV QDRANT_URL=http://localhost:6333
package.json CHANGED
@@ -8,8 +8,7 @@
8
  "tooling/*"
9
  ],
10
  "overrides": {
11
- "zod": "$zod",
12
- "onnxruntime-node": "npm:onnxruntime-node-gpu@^1.21.0"
13
  },
14
  "scripts": {
15
  "build": "turbo run build",
 
8
  "tooling/*"
9
  ],
10
  "overrides": {
11
+ "zod": "$zod"
 
12
  },
13
  "scripts": {
14
  "build": "turbo run build",
packages/benchmark/hf-space/Dockerfile CHANGED
@@ -12,26 +12,20 @@
12
  # =============================================================================
13
 
14
  # -----------------------------------------------------------------------------
15
- # Single stage build with CUDA support (needed for onnxruntime-node-gpu)
16
  # -----------------------------------------------------------------------------
17
- FROM nvidia/cuda:12.3.2-cudnn9-devel-ubuntu22.04
18
 
19
- # Install Node.js 22 LTS and build dependencies
 
 
20
  RUN apt-get update && apt-get install -y \
21
- curl \
22
- ca-certificates \
23
- wget \
24
- jq \
25
  python3 \
26
  make \
27
  g++ \
28
  git \
29
- && curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
30
- && apt-get install -y nodejs \
31
  && rm -rf /var/lib/apt/lists/*
32
 
33
- WORKDIR /app
34
-
35
  # Copy monorepo package files
36
  COPY package*.json ./
37
  COPY packages/benchmark/package.json packages/benchmark/
@@ -42,21 +36,41 @@ COPY packages/logger/package.json packages/logger/
42
  COPY packages/common/package.json packages/common/
43
  COPY packages/temporal/package.json packages/temporal/
44
 
45
- # Install all dependencies with GPU support
46
  RUN npm install --include=dev
47
 
48
  # Copy source code
49
  COPY packages/ packages/
50
  COPY biome.json ./
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  # Model cache directory
53
  ENV HF_HOME=/app/.cache
54
  ENV TRANSFORMERS_CACHE=/app/.cache
55
  ENV XDG_CACHE_HOME=/app/.cache
56
 
57
  # Create cache directory for models (downloaded on first run)
58
- # Skipping model preload during Docker build to avoid build failures
59
- # Models will be cached after first run
60
  RUN mkdir -p /app/.cache
61
 
62
  # Install Qdrant for local vector search
@@ -93,7 +107,7 @@ ENV NODE_ENV=production
93
  ENV BENCHMARK_VERBOSE=true
94
  ENV NODE_OPTIONS="--max-old-space-size=24576"
95
 
96
- # GPU mode with FP16 for L4
97
  ENV EMBEDDER_DEVICE=cuda
98
  ENV EMBEDDER_DTYPE=fp16
99
  ENV QDRANT_URL=http://localhost:6333
 
12
  # =============================================================================
13
 
14
  # -----------------------------------------------------------------------------
15
+ # Stage 1: Build dependencies
16
  # -----------------------------------------------------------------------------
17
+ FROM node:22-bookworm-slim AS builder
18
 
19
+ WORKDIR /app
20
+
21
+ # Install build essentials for native modules
22
  RUN apt-get update && apt-get install -y \
 
 
 
 
23
  python3 \
24
  make \
25
  g++ \
26
  git \
 
 
27
  && rm -rf /var/lib/apt/lists/*
28
 
 
 
29
  # Copy monorepo package files
30
  COPY package*.json ./
31
  COPY packages/benchmark/package.json packages/benchmark/
 
36
  COPY packages/common/package.json packages/common/
37
  COPY packages/temporal/package.json packages/temporal/
38
 
39
+ # Install all dependencies
40
  RUN npm install --include=dev
41
 
42
  # Copy source code
43
  COPY packages/ packages/
44
  COPY biome.json ./
45
 
46
+ # -----------------------------------------------------------------------------
47
+ # Stage 2: Runtime image with CUDA support
48
+ # -----------------------------------------------------------------------------
49
+ FROM nvidia/cuda:12.3.2-cudnn9-runtime-ubuntu22.04
50
+
51
+ # Install Node.js 22 LTS and system dependencies
52
+ RUN apt-get update && apt-get install -y \
53
+ curl \
54
+ ca-certificates \
55
+ wget \
56
+ jq \
57
+ && curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
58
+ && apt-get install -y nodejs \
59
+ && rm -rf /var/lib/apt/lists/*
60
+
61
+ WORKDIR /app
62
+
63
+ # Copy built application from builder
64
+ COPY --from=builder /app/node_modules ./node_modules
65
+ COPY --from=builder /app/packages ./packages
66
+ COPY --from=builder /app/package*.json ./
67
+
68
  # Model cache directory
69
  ENV HF_HOME=/app/.cache
70
  ENV TRANSFORMERS_CACHE=/app/.cache
71
  ENV XDG_CACHE_HOME=/app/.cache
72
 
73
  # Create cache directory for models (downloaded on first run)
 
 
74
  RUN mkdir -p /app/.cache
75
 
76
  # Install Qdrant for local vector search
 
107
  ENV BENCHMARK_VERBOSE=true
108
  ENV NODE_OPTIONS="--max-old-space-size=24576"
109
 
110
+ # GPU mode with FP16 for L4 (onnxruntime-node auto-detects CUDA)
111
  ENV EMBEDDER_DEVICE=cuda
112
  ENV EMBEDDER_DTYPE=fp16
113
  ENV QDRANT_URL=http://localhost:6333
packages/search/package.json CHANGED
@@ -14,7 +14,6 @@
14
  "@engram/common": "*",
15
  "@engram/logger": "*",
16
  "@huggingface/transformers": "^3.8.1",
17
- "onnxruntime-node-gpu": "^1.21.0",
18
  "@qdrant/js-client-rest": "^1.16.2",
19
  "ai": "^4.3.16",
20
  "chrono-node": "^2.9.0",
 
14
  "@engram/common": "*",
15
  "@engram/logger": "*",
16
  "@huggingface/transformers": "^3.8.1",
 
17
  "@qdrant/js-client-rest": "^1.16.2",
18
  "ai": "^4.3.16",
19
  "chrono-node": "^2.9.0",