printhive/Dockerfile
dlawler489 0f49fe8c1a AI tags and descriptions, search by meaning, and automatic tags
- AI tagging through any OpenAI-compatible API: DeepSeek by default, or
  OpenRouter, OpenAI, or a local server (Ollama, LM Studio). Settings → AI
  with presets, prices and "Save & test connection"; the key never leaves
  the server except to the provider.
- Runs over untagged models, all models, or one model from its page: live
  progress, tokens and cost, stop/resume (retrying failures), an optional
  spending limit, and paused rather than resumed after a restart. Adapts to
  models without JSON mode or image input; stops on a rejected key or no
  credit. Tags are only added; descriptions filled only where empty unless
  asked.
- Search by meaning: local bge-small-en-v1.5 embeddings (transformers.js),
  indexed in the background whenever a model's text changes; Words/Meaning
  switch on the search box. Stored as REAL[] in Postgres, no pgvector needed.
- Automatic tags: strict whole-word rules (part types, mechanisms, materials,
  techniques) over names, file names and archive contents, plus your own
  word -> tag rules; on/off (optionally removing its tags) and re-apply.
- Tags remember where they came from (user / rule / ai); edits keep that,
  rule and AI passes never touch your own tags, and the model page marks them.
- Docker: ships the embedding model and only Linux onnxruntime binaries.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 11:12:58 +10:00

37 lines
1.3 KiB
Docker

# Printhive — Node app + Python/trimesh sidecar (for 3MF -> GLB conversion)
FROM node:22-bookworm-slim
# Python is needed at runtime for the 3MF->GLB / volume sidecar.
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3 python3-venv \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Tell the converter where Python lives (the venv built below).
ENV PYTHON_BIN=/app/tools/venv/bin/python
# Python sidecar deps (cached unless requirements.txt changes).
COPY tools/requirements.txt ./tools/requirements.txt
RUN python3 -m venv /app/tools/venv \
&& /app/tools/venv/bin/pip install --no-cache-dir -r tools/requirements.txt
# Node deps (cached unless package files change).
COPY package.json package-lock.json ./
RUN npm ci --omit=dev \
# semantic search only needs onnxruntime's Linux binaries (saves ~130 MB)
&& rm -rf node_modules/onnxruntime-node/bin/napi-v3/darwin node_modules/onnxruntime-node/bin/napi-v3/win32
# App source.
COPY . .
# The embedding model for semantic search (~34 MB), fetched at build time so the
# server never has to download it.
ENV MODELS_DIR=/app/models
RUN node -e "require('./lib/embeddingModel').load().then(() => console.log('embedding model ready'))"
ENV NODE_ENV=production \
PORT=3000
EXPOSE 3000
CMD ["node", "server.js"]