Dockerfile 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. FROM rust:1.71-bullseye as builder
  2. WORKDIR /usr/src/kuberian
  3. # Install intel-mkl
  4. RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
  5. | gpg --dearmor | tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null && \
  6. echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | \
  7. tee /etc/apt/sources.list.d/oneAPI.list
  8. RUN apt update
  9. RUN apt install -y intel-oneapi-mkl-devel libomp-dev
  10. # Make cache layers
  11. COPY Cargo.toml .
  12. COPY ci src/
  13. RUN cargo build -r -F mkl
  14. RUN rm -rf src
  15. # Build final binaries
  16. COPY . .
  17. # to make sure that cargo recompile the kuberian
  18. RUN touch src/*
  19. RUN cargo install --path . -F mkl
  20. # Downloads Embedding Models or ETC
  21. ENV HF_HOME=/model
  22. RUN kuberian --ci
  23. FROM gcr.io/distroless/cc-debian11
  24. WORKDIR /app
  25. COPY --from=builder /opt/intel/oneapi/compiler/latest/linux/compiler/lib/intel64_lin/libiomp5.so /usr/lib/
  26. COPY --from=builder /model /model
  27. COPY --from=builder /usr/local/cargo/bin/kuberian /usr/local/bin/kuberian
  28. ADD https://s3.iwanhae.kr/kuberian/kuberian.db ./kuberian.db
  29. ADD https://s3.iwanhae.kr/kuberian/kuberian.usearch ./kuberian.usearch
  30. EXPOSE 8080
  31. ENV HF_HOME=/model
  32. CMD ["kuberian"]