File size: 948 Bytes
1c664ac
eb6c83d
 
1c664ac
 
223189f
424381c
1c664ac
 
 
 
 
 
 
 
 
 
 
 
 
 
3bf1cd6
1c664ac
 
 
 
 
 
 
 
 
 
eb6c83d
1c664ac
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
FROM python:3.11-slim

WORKDIR /app
RUN useradd -m -u 1000 appuser
RUN mkdir -p /app/saved_models && chown -R appuser:appuser /app
COPY requirements.txt .

# Install build dependencies, including Python development tools and gflags
RUN apt-get update && apt-get install -y \
    build-essential \
    libatlas-base-dev \
    gfortran \
    swig \
    git \
    cmake \
    python3-dev \
    libgflags-dev \
    && rm -rf /var/lib/apt/lists/*

# Install NumPy before building FAISS
RUN pip install --no-cache-dir numpy

# Build and install FAISS
RUN git clone https://github.com/facebookresearch/faiss.git /faiss \
    && cd /faiss \
    && mkdir build && cd build \
    && cmake -DFAISS_ENABLE_GPU=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=/usr/local .. \
    && make -j$(nproc) \
    && make install

# Install remaining Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

COPY . .
USER appuser
CMD ["python", "app.py"]