Dockerfile 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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_JWT_SECRET_KEY "SECRET_KEY"
  18. WORKDIR /app/backend
  19. # install python dependencies
  20. COPY ./backend/requirements.txt ./requirements.txt
  21. RUN pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu --no-cache-dir
  22. RUN pip3 install -r requirements.txt --no-cache-dir
  23. # Install pandoc and netcat
  24. # RUN python -c "import pypandoc; pypandoc.download_pandoc()"
  25. RUN apt-get update \
  26. && apt-get install -y pandoc netcat-openbsd \
  27. && rm -rf /var/lib/apt/lists/*
  28. # RUN python -c "from sentence_transformers import SentenceTransformer; model = SentenceTransformer('all-MiniLM-L6-v2')"
  29. # copy embedding weight from build
  30. RUN mkdir -p /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2
  31. COPY --from=build /app/onnx /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2/onnx
  32. # copy built frontend files
  33. COPY --from=build /app/build /app/build
  34. # copy backend files
  35. COPY ./backend .
  36. CMD [ "sh", "start.sh" ]