Spaces:
Runtime error
Runtime error
Commit
·
ecf18d6
1
Parent(s):
c142783
updatecode
Browse files- Dockerfile +21 -29
- requirements.txt +10 -11
Dockerfile
CHANGED
|
@@ -1,48 +1,40 @@
|
|
| 1 |
-
#
|
| 2 |
-
FROM
|
| 3 |
|
| 4 |
# Set environment variables
|
| 5 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
ENV PYTHONUNBUFFERED=1
|
| 7 |
|
| 8 |
-
#
|
| 9 |
-
RUN apt-get update && apt-get install -y
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
#
|
| 14 |
-
|
| 15 |
-
python3.11 python3.11-distutils python3.11-dev wget git unzip && \
|
| 16 |
-
rm -rf /var/lib/apt/lists/*
|
| 17 |
-
|
| 18 |
-
# Install pip using get-pip.py (bypasses any outdated or broken system pip)
|
| 19 |
-
RUN wget https://bootstrap.pypa.io/get-pip.py && \
|
| 20 |
-
python3.11 get-pip.py && \
|
| 21 |
-
rm get-pip.py
|
| 22 |
-
|
| 23 |
-
# Update alternatives to set Python 3.11 as default
|
| 24 |
-
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 && \
|
| 25 |
-
update-alternatives --config python3
|
| 26 |
|
| 27 |
# Set Hugging Face cache directory
|
| 28 |
ENV HF_HOME=/app/cache
|
| 29 |
RUN mkdir -p /app/cache && chmod -R 777 /app/cache
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
# Create directories with proper read/write permissions
|
| 32 |
RUN mkdir -p /app/uploads/vectors && chmod -R 777 /app/uploads
|
| 33 |
|
| 34 |
-
#
|
| 35 |
-
WORKDIR /app
|
| 36 |
-
|
| 37 |
-
# Copy the application files
|
| 38 |
COPY . .
|
| 39 |
|
| 40 |
-
#
|
| 41 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 42 |
-
RUN python3 -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2', cache_folder='/app/cache')"
|
| 43 |
-
|
| 44 |
-
# Expose the Flask app's port
|
| 45 |
EXPOSE 7860
|
| 46 |
|
| 47 |
# Start the Flask app
|
| 48 |
-
CMD ["
|
|
|
|
| 1 |
+
# Use the official Python 3.11 slim image
|
| 2 |
+
FROM python:3.11-slim
|
| 3 |
|
| 4 |
# Set environment variables
|
| 5 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
ENV PYTHONUNBUFFERED=1
|
| 7 |
|
| 8 |
+
# Install basic build tools and libraries (required by faiss-cpu, PyMuPDF, etc.)
|
| 9 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 10 |
+
build-essential \
|
| 11 |
+
cmake \
|
| 12 |
+
libopenblas-dev \
|
| 13 |
+
libomp-dev \
|
| 14 |
+
poppler-utils \
|
| 15 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 16 |
|
| 17 |
+
# Create a working directory
|
| 18 |
+
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
# Set Hugging Face cache directory
|
| 21 |
ENV HF_HOME=/app/cache
|
| 22 |
RUN mkdir -p /app/cache && chmod -R 777 /app/cache
|
| 23 |
|
| 24 |
+
# Copy requirements first (for Docker layer caching)
|
| 25 |
+
COPY requirements.txt .
|
| 26 |
+
|
| 27 |
+
# Install Python dependencies (no version pinning)
|
| 28 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 29 |
+
|
| 30 |
# Create directories with proper read/write permissions
|
| 31 |
RUN mkdir -p /app/uploads/vectors && chmod -R 777 /app/uploads
|
| 32 |
|
| 33 |
+
# Copy the rest of the application files
|
|
|
|
|
|
|
|
|
|
| 34 |
COPY . .
|
| 35 |
|
| 36 |
+
# Expose the port used by your Flask app (e.g., 7860)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
EXPOSE 7860
|
| 38 |
|
| 39 |
# Start the Flask app
|
| 40 |
+
CMD ["python", "run.py"]
|
requirements.txt
CHANGED
|
@@ -1,11 +1,10 @@
|
|
| 1 |
-
Flask
|
| 2 |
-
transformers
|
| 3 |
-
sentence-transformers
|
| 4 |
-
torch
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
huggingface-hub==0.15.1
|
|
|
|
| 1 |
+
Flask
|
| 2 |
+
transformers
|
| 3 |
+
sentence-transformers
|
| 4 |
+
torch
|
| 5 |
+
faiss-cpu
|
| 6 |
+
PyMuPDF
|
| 7 |
+
python-pptx
|
| 8 |
+
pandas
|
| 9 |
+
numpy
|
| 10 |
+
huggingface-hub
|
|
|