Dockerfile 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # syntax=docker/dockerfile:1
  2. FROM node:alpine as build
  3. WORKDIR /app
  4. # wget embedding model weight from alpine (does not exist from slim-buster)
  5. RUN wget "https://chroma-onnx-models.s3.amazonaws.com/all-MiniLM-L6-v2/onnx.tar.gz" -O - | \
  6. tar -xzf - -C /app
  7. COPY package.json package-lock.json ./
  8. RUN npm ci
  9. COPY . .
  10. RUN npm run build
  11. FROM python:3.11-slim-bookworm as base
  12. ENV ENV=prod
  13. ENV PORT ""
  14. ENV OLLAMA_API_BASE_URL "/ollama/api"
  15. ENV OPENAI_API_BASE_URL ""
  16. ENV OPENAI_API_KEY ""
  17. ENV WEBUI_SECRET_KEY ""
  18. ENV SCARF_NO_ANALYTICS true
  19. ENV DO_NOT_TRACK true
  20. WORKDIR /app/backend
  21. # install python dependencies
  22. COPY ./backend/requirements.txt ./requirements.txt
  23. RUN pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu --no-cache-dir
  24. RUN pip3 install -r requirements.txt --no-cache-dir
  25. # Install pandoc and netcat
  26. # RUN python -c "import pypandoc; pypandoc.download_pandoc()"
  27. RUN apt-get update \
  28. && apt-get install -y pandoc netcat-openbsd \
  29. && rm -rf /var/lib/apt/lists/*
  30. # RUN python -c "from sentence_transformers import SentenceTransformer; model = SentenceTransformer('all-MiniLM-L6-v2')"
  31. # copy embedding weight from build
  32. RUN mkdir -p /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2
  33. COPY --from=build /app/onnx /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2/onnx
  34. # copy built frontend files
  35. COPY --from=build /app/build /app/build
  36. # copy backend files
  37. COPY ./backend .
  38. CMD [ "bash", "start.sh"]