Muhammad541 commited on
Commit
1c664ac
·
verified ·
1 Parent(s): c00886a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -7
Dockerfile CHANGED
@@ -1,13 +1,36 @@
1
- FROM python:3.9-slim
2
 
3
  WORKDIR /app
4
-
 
5
  COPY requirements.txt .
6
- RUN pip install --no-cache-dir -r requirements.txt
7
 
8
- COPY app.py .
9
- COPY data/ data/ # Copy remaining datasets
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
- EXPOSE 7860
 
 
 
 
 
 
 
 
 
12
 
13
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
1
+ FROM python:3.11-slim
2
 
3
  WORKDIR /app
4
+ RUN useradd -m -u 1000 appuser
5
+ RUN mkdir -p /app/saved_models && chown -R appuser:appuser /app
6
  COPY requirements.txt .
 
7
 
8
+ # Install build dependencies, including Python development tools and gflags
9
+ RUN apt-get update && apt-get install -y \
10
+ build-essential \
11
+ libatlas-base-dev \
12
+ gfortran \
13
+ swig \
14
+ git \
15
+ cmake \
16
+ python3-dev \
17
+ libgflags-dev \
18
+ && rm -rf /var/lib/apt/lists/*
19
+
20
+ # Install NumPy before building FAISS
21
+ RUN pip install --no-cache-dir numpy
22
 
23
+ # Build and install FAISS
24
+ RUN git clone https://github.com/facebookresearch/faiss.git /faiss \
25
+ && cd /faiss \
26
+ && mkdir build && cd build \
27
+ && cmake -DFAISS_ENABLE_GPU=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=/usr/local .. \
28
+ && make -j$(nproc) \
29
+ && make install
30
+
31
+ # Install remaining Python dependencies
32
+ RUN pip install --no-cache-dir -r requirements.txt
33
 
34
+ COPY . .
35
+ USER appuser
36
+ CMD ["python", "app.py"]