Dockerfile 989 B

12345678910111213141516171819202122232425262728293031323334
  1. FROM python:3.12-slim
  2. RUN apt-get update && apt-get install -y \
  3. software-properties-common \
  4. build-essential \
  5. pkg-config \
  6. cmake \
  7. libopenblas-dev \
  8. liblapack-dev \
  9. liblapacke-dev \
  10. python3-pip \
  11. curl \
  12. git
  13. RUN git clone https://github.com/ml-explore/mlx.git && cd mlx && mkdir -p build && cd build && \
  14. cmake .. \
  15. -DCMAKE_PREFIX_PATH="/usr/lib/aarch64-linux-gnu" \
  16. -DLAPACK_LIBRARIES="/usr/lib/aarch64-linux-gnu/liblapack.so" \
  17. -DBLAS_LIBRARIES="/usr/lib/aarch64-linux-gnu/libopenblas.so" \
  18. -DLAPACK_INCLUDE_DIRS="/usr/include" && \
  19. sed -i 's/option(MLX_BUILD_METAL "Build metal backend" ON)/option(MLX_BUILD_METAL "Build metal backend" OFF)/' ../CMakeLists.txt && \
  20. make -j && \
  21. make install && \
  22. cd .. && \
  23. pip install --no-cache-dir .
  24. RUN pip install --no-cache-dir numpy
  25. # Add library path
  26. ENV LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH}"
  27. COPY test.py .
  28. CMD ["python3", "test.py"]