facebookresearch-faiss
SUCCESS
11m 33s
History Source
SummaryIterations1Transcript7Dockerfile
Dockerfile43 lines · 1457 chars
FROM ubuntu:22.04

# Non-interactive for automated builds
ENV DEBIAN_FRONTEND=noninteractive

# Install build tools and dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
  ca-certificates \
  gnupg \
  wget \
  curl \
  build-essential cmake git swig python3 python3-dev python3-pip \
  libomp-dev libopenblas-dev libgflags-dev pkg-config \
  && rm -rf /var/lib/apt/lists/*

# Install a newer CMake (>=3.24) since the project requires it
RUN mkdir -p /opt/cmake && \
  cd /opt/cmake && \
  wget -q https://cmake.org/files/v3.26/cmake-3.26.5-linux-x86_64.tar.gz && \
  tar -xzf cmake-3.26.5-linux-x86_64.tar.gz --strip-components=1 && \
  rm cmake-3.26.5-linux-x86_64.tar.gz
ENV PATH=/opt/cmake/bin:$PATH

# Install Python dependencies useful for FAISS Python bindings/tests
RUN python3 -m pip install --upgrade pip \
  && pip3 install numpy==1.26.4 scipy pytest

# Copy source code into the image (assumes repo is at build context root)
WORKDIR /faiss
COPY . /faiss

# Build FAISS from source
RUN mkdir -p build && cd build \
  && cmake -DFAISS_ENABLE_GPU=OFF -DFAISS_ENABLE_CUVS=OFF -DFAISS_ENABLE_PYTHON=OFF -DFAISS_ENABLE_EXTRAS=OFF -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release .. \
  && cmake --build . -j$(nproc) \
  && cmake --install .

# Ensure runtime linker can find libraries built by FAISS install
ENV LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}

# Default to a shell to inspect the image
CMD ["/bin/bash"]