File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,14 +55,13 @@ LABEL org.opencontainers.image.description="MoltNet REST API"
5555LABEL org.opencontainers.image.licenses="MIT"
5656
5757ENV NODE_ENV=production \
58- EMBEDDING_CACHE_DIR=/app/dist/ models \
59- EMBEDDING_ALLOW_REMOTE_MODELS=false
58+ EMBEDDING_CACHE_DIR=/app/models \
59+ EMBEDDING_ALLOW_REMOTE_MODELS=true
6060WORKDIR /app
6161
6262# Runtime tree: app + production node_modules, linux-native.
6363# `pnpm deploy` copies only the package's `files` glob (dist/, public/) plus
6464# the trimmed node_modules; dev configs and source are excluded automatically.
65- # `dist/models/` rides along inside `dist/` (host-built by `download-model`).
6665COPY --from=build /out ./
6766
6867# Drizzle migration SQL — consumed by the migrate entrypoint and Fly.io
Original file line number Diff line number Diff line change @@ -17,8 +17,9 @@ docker compose --env-file .env.local up -d
1717
1818### Embedding model (one-time setup)
1919
20- The API eagerly warms the ONNX embedding pipeline on startup. The model must be
21- pre-downloaded locally before running in offline mode.
20+ The API eagerly warms the ONNX embedding pipeline on startup. By default, the model will be downloaded from Hugging Face at startup time.
21+
22+ For offline development or to avoid repeated downloads, you can pre-download the model:
2223
2324** Why ` apps/rest-api/models/ ` and not the repo root?**
2425pnpm sets the process cwd to ` apps/rest-api/ ` when running the dev script, so
Original file line number Diff line number Diff line change 111111 " {projectRoot}/dist/migrate.js"
112112 ]
113113 },
114- "download-model" : {
115- "cache" : true ,
116- "dependsOn" : [
117- " build"
118- ],
119- "executor" : " nx:run-commands" ,
120- "inputs" : [
121- {
122- "runtime" : " node --version"
123- },
124- " {workspaceRoot}/tools/download-embedding-model.mjs" ,
125- {
126- "externalDependencies" : [
127- " @huggingface/transformers" ,
128- " onnxruntime-node"
129- ]
130- }
131- ],
132- "options" : {
133- "command" : " node tools/download-embedding-model.mjs --cache-dir apps/rest-api/dist/models" ,
134- "cwd" : " {workspaceRoot}"
135- },
136- "outputs" : [
137- " {projectRoot}/dist/models"
138- ]
139- },
140114 "docker:build" : {
141115 "dependsOn" : [
142- " build:migrate" ,
143- " download-model"
116+ " build:migrate"
144117 ]
145118 },
146119 "e2e" : {
You can’t perform that action at this time.
0 commit comments