Update Dockerfile
Browse files- Dockerfile +5 -36
Dockerfile
CHANGED
|
@@ -7,36 +7,16 @@ RUN apt-get update && apt-get install -y \
|
|
| 7 |
git \
|
| 8 |
wget \
|
| 9 |
curl \
|
| 10 |
-
build-essential \
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
-
# Copy
|
| 14 |
COPY requirements.txt .
|
| 15 |
-
|
| 16 |
-
# Install Python dependencies with proper version resolution
|
| 17 |
RUN pip install --no-cache-dir --upgrade pip
|
| 18 |
-
|
| 19 |
-
# First, ensure no deprecated Pinecone plugins are present
|
| 20 |
-
RUN pip uninstall pinecone-plugin-inference pinecone-plugin-records pinecone-plugin-assistant pinecone-client -y || true
|
| 21 |
-
|
| 22 |
-
# Install numpy first to prevent conflicts
|
| 23 |
-
RUN pip install --no-cache-dir "numpy>=1.26.4,<2.0"
|
| 24 |
-
|
| 25 |
-
# Install Pinecone without deprecated plugins
|
| 26 |
-
RUN pip install --no-cache-dir "pinecone>=7.0.0"
|
| 27 |
-
|
| 28 |
-
# Install LangChain packages
|
| 29 |
-
RUN pip install --no-cache-dir "langchain-pinecone>=0.2.11" "langchain>=0.3.7"
|
| 30 |
-
|
| 31 |
-
# Install remaining dependencies
|
| 32 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 33 |
|
| 34 |
-
#
|
| 35 |
-
RUN
|
| 36 |
-
|
| 37 |
-
# Create cache directories with proper permissions
|
| 38 |
-
RUN mkdir -p /tmp/huggingface_cache /tmp/transformers_cache /app/nltk_data /tmp/sentence_transformers_cache
|
| 39 |
-
RUN chmod 777 /tmp/huggingface_cache /tmp/transformers_cache /tmp/sentence_transformers_cache
|
| 40 |
|
| 41 |
# Download NLTK data
|
| 42 |
RUN python -c "import nltk; nltk.download('punkt', download_dir='/app/nltk_data')"
|
|
@@ -44,22 +24,11 @@ RUN python -c "import nltk; nltk.download('punkt', download_dir='/app/nltk_data'
|
|
| 44 |
# Copy application code
|
| 45 |
COPY . .
|
| 46 |
|
| 47 |
-
# Set environment variables
|
| 48 |
ENV PYTHONPATH=/app
|
| 49 |
ENV NLTK_DATA=/app/nltk_data
|
| 50 |
ENV HF_HOME=/tmp/huggingface_cache
|
| 51 |
ENV TRANSFORMERS_CACHE=/tmp/transformers_cache
|
| 52 |
-
ENV SENTENCE_TRANSFORMERS_HOME=/tmp/sentence_transformers_cache
|
| 53 |
-
ENV XDG_CACHE_HOME=/tmp
|
| 54 |
-
|
| 55 |
-
# Set API environment variables (will be overridden at runtime)
|
| 56 |
-
ENV PINECONE_API_KEY=""
|
| 57 |
-
ENV GEMINI_API_KEY=""
|
| 58 |
-
ENV HF_TOKEN=""
|
| 59 |
-
|
| 60 |
-
# Add health check
|
| 61 |
-
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
| 62 |
-
CMD curl -f http://localhost:7860/health || exit 1
|
| 63 |
|
| 64 |
EXPOSE 7860
|
| 65 |
|
|
|
|
| 7 |
git \
|
| 8 |
wget \
|
| 9 |
curl \
|
|
|
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
+
# Copy and install requirements
|
| 13 |
COPY requirements.txt .
|
|
|
|
|
|
|
| 14 |
RUN pip install --no-cache-dir --upgrade pip
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
|
| 17 |
+
# Create cache directories
|
| 18 |
+
RUN mkdir -p /tmp/huggingface_cache /tmp/transformers_cache /app/nltk_data
|
| 19 |
+
RUN chmod 777 /tmp/huggingface_cache /tmp/transformers_cache
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
# Download NLTK data
|
| 22 |
RUN python -c "import nltk; nltk.download('punkt', download_dir='/app/nltk_data')"
|
|
|
|
| 24 |
# Copy application code
|
| 25 |
COPY . .
|
| 26 |
|
| 27 |
+
# Set environment variables
|
| 28 |
ENV PYTHONPATH=/app
|
| 29 |
ENV NLTK_DATA=/app/nltk_data
|
| 30 |
ENV HF_HOME=/tmp/huggingface_cache
|
| 31 |
ENV TRANSFORMERS_CACHE=/tmp/transformers_cache
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
EXPOSE 7860
|
| 34 |
|