# AskNeo backend + RAG in a single image. # # FastAPI is public on :8000; the Node RAG service runs on localhost:8787, so the # backend reaches it over loopback and we only run one container. Multi-arch base # images + wheels mean this builds on both Oracle's ARM (Ampere A1) and AMD VMs. FROM node:20-bookworm-slim AS node FROM python:3.12-slim-bookworm # Bring Node + npm across from the official node image (avoids an apt/curl dance). COPY --from=node /usr/local/bin/node /usr/local/bin/node COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules RUN ln -sf /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \ && ln -sf /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx WORKDIR /app # Python deps (backend) — copy the manifest first so this layer caches. COPY backend/requirements.txt ./backend/requirements.txt RUN pip install --no-cache-dir -r backend/requirements.txt # Node deps (RAG). tsx is a devDependency but used at runtime, so install all. COPY rag/package.json rag/package-lock.json ./rag/ RUN cd rag && npm ci # App source. Vectors live in Pinecone now, so no index files are baked in. COPY backend ./backend COPY rag ./rag COPY start.sh ./start.sh RUN chmod +x ./start.sh # Defaults; override DB_PATH and the API keys via the container environment. ENV PORT=8000 \ RAG_PORT=8787 \ RAG_SERVER_URL=http://localhost:8787 \ DB_PATH=/data/database.db EXPOSE 8000 CMD ["./start.sh"]