# Open Art Search API — Hugging Face Docker Space. Staged by scripts/deploy-api.sh with the same layout as app/ # (package.json + lockfile, src/ core modules, server/, public/data//), so imports resolve exactly as in the repo. FROM node:22-bookworm-slim ENV NODE_ENV=production PORT=7860 MODEL_DIR=/home/node/app/.model # Spaces run containers as uid 1000, which is the image's "node" user USER node WORKDIR /home/node/app COPY --chown=node package.json package-lock.json ./ # same lockfile as the app: production deps only (@huggingface/transformers → onnxruntime-node) RUN npm ci --omit=dev --no-audit --no-fund && npm cache clean --force # bake the public query model (pinned revision) into the image and load it offline once, as the server will; # at runtime the model is read from MODEL_DIR with remote access disabled COPY --chown=node server/embed.mjs server/ RUN node server/embed.mjs --prefetch COPY --chown=node src/ src/ COPY --chown=node server/ server/ COPY --chown=node public/data/ public/data/ EXPOSE 7860 CMD ["node", "server/server.mjs"]