chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
ARG PYTHON_VERSION=3.11
|
||||
FROM python:${PYTHON_VERSION}-slim
|
||||
|
||||
ARG LEANN_VERSION=0.3.6
|
||||
|
||||
ENV PIP_NO_CACHE_DIR=1 \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
||||
PIP_ROOT_USER_ACTION=ignore
|
||||
|
||||
# Keep runtime image minimal while ensuring common C++ runtime libs are present.
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
libgomp1 \
|
||||
libstdc++6 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN python -m pip install --upgrade pip \
|
||||
&& pip install --prefer-binary "leann==${LEANN_VERSION}" \
|
||||
&& python -c "import leann; import leann_backend_hnsw; import leann_backend_diskann"
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
CMD ["python", "-c", "import leann; print('LEANN installed and importable.')"]
|
||||
@@ -0,0 +1,25 @@
|
||||
ARG PYTHON_VERSION=3.11
|
||||
FROM python:${PYTHON_VERSION}-slim
|
||||
|
||||
ARG LEANN_VERSION=0.3.6
|
||||
|
||||
ENV PIP_NO_CACHE_DIR=1 \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
||||
PIP_ROOT_USER_ACTION=ignore \
|
||||
PIP_INDEX_URL=https://download.pytorch.org/whl/cpu \
|
||||
PIP_EXTRA_INDEX_URL=https://pypi.org/simple
|
||||
|
||||
# Keep runtime image minimal while ensuring common C++ runtime libs are present.
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
libgomp1 \
|
||||
libstdc++6 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN python -m pip install --upgrade pip \
|
||||
&& pip install --prefer-binary "leann==${LEANN_VERSION}" \
|
||||
&& python -c "import leann; import leann_backend_hnsw; import leann_backend_diskann"
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
CMD ["python", "-c", "import leann; print('LEANN installed and importable (CPU image).')"]
|
||||
@@ -0,0 +1,38 @@
|
||||
ARG PYTHON_VERSION=3.11
|
||||
FROM python:${PYTHON_VERSION}-slim
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive \
|
||||
PIP_NO_CACHE_DIR=1 \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
||||
PIP_ROOT_USER_ACTION=ignore
|
||||
|
||||
# Build + test toolchain for local development in container.
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
cmake \
|
||||
git \
|
||||
swig \
|
||||
libomp-dev \
|
||||
libboost-all-dev \
|
||||
protobuf-compiler \
|
||||
libzmq3-dev \
|
||||
pkg-config \
|
||||
libabsl-dev \
|
||||
libaio-dev \
|
||||
libprotobuf-dev \
|
||||
libopenblas-dev \
|
||||
liblapack-dev \
|
||||
liblapacke-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN python -m pip install --upgrade pip \
|
||||
&& pip install uv
|
||||
|
||||
WORKDIR /workspace
|
||||
COPY . /workspace
|
||||
|
||||
# Keep dependency install explicit; default includes lint + test groups.
|
||||
RUN uv sync --group lint --group test
|
||||
|
||||
CMD ["/bin/bash"]
|
||||
@@ -0,0 +1,50 @@
|
||||
# Docker Setup
|
||||
|
||||
This folder provides reference Docker images for LEANN.
|
||||
|
||||
## Build (default)
|
||||
|
||||
Default image (no forced CPU index):
|
||||
|
||||
```bash
|
||||
docker build -f docker/Dockerfile docker -t leann:latest
|
||||
```
|
||||
|
||||
## Build (CPU)
|
||||
|
||||
CPU-optimized image (forces PyTorch CPU index):
|
||||
|
||||
```bash
|
||||
docker build \
|
||||
--build-arg PYTHON_VERSION=3.12 \
|
||||
--build-arg LEANN_VERSION=0.3.6 \
|
||||
-f docker/Dockerfile.cpu docker -t leann:cpu
|
||||
```
|
||||
|
||||
## Build (development)
|
||||
|
||||
Development image (source tree + build/test toolchain + `uv sync`):
|
||||
|
||||
```bash
|
||||
docker build -f docker/Dockerfile.dev . -t leann:dev
|
||||
```
|
||||
|
||||
## Run
|
||||
|
||||
```bash
|
||||
docker run --rm leann:latest
|
||||
docker run --rm leann:cpu
|
||||
docker run --rm -it leann:dev
|
||||
```
|
||||
|
||||
Expected output:
|
||||
|
||||
```text
|
||||
LEANN installed and importable.
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- Both images keep LEANN package semantics unchanged (`pip install leann` with both backends).
|
||||
- `Dockerfile.cpu` uses the PyTorch CPU index to avoid downloading CUDA wheels.
|
||||
- `Dockerfile.dev` is for local development, not production deployment.
|
||||
Reference in New Issue
Block a user