mike23415 commited on
Commit
00ff2f5
·
verified ·
1 Parent(s): d2d0219

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -16
Dockerfile CHANGED
@@ -1,29 +1,29 @@
1
- # Use optimized Python image
2
  FROM python:3.9-slim
3
 
4
  # Set the working directory inside the container
5
  WORKDIR /app
6
 
7
- # Install required system dependencies for OCR & PDFs
 
 
 
 
8
  RUN apt-get update && apt-get install -y \
9
- tesseract-ocr \
10
- poppler-utils \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
- # Set environment variables for Hugging Face cache
14
- ENV HF_HOME=/tmp/cache
15
- RUN mkdir -p /tmp/cache && chmod 777 /tmp/cache
16
-
17
- # Install Python dependencies
18
- COPY requirements.txt requirements.txt
19
- RUN pip install --no-cache-dir --upgrade pip
20
- RUN pip install --no-cache-dir -r requirements.txt
21
-
22
- # Copy the application code
23
  COPY . .
24
 
25
- # Expose the port for API access
26
  EXPOSE 7860
27
 
28
- # Use Gunicorn for production
 
 
 
 
 
29
  CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:7860", "app:app"]
 
1
+ # Use a lightweight Python image
2
  FROM python:3.9-slim
3
 
4
  # Set the working directory inside the container
5
  WORKDIR /app
6
 
7
+ # Copy requirements file and install dependencies
8
+ COPY requirements.txt .
9
+ RUN pip install --no-cache-dir -r requirements.txt
10
+
11
+ # Ensure necessary libraries for Hugging Face and document processing
12
  RUN apt-get update && apt-get install -y \
13
+ libgl1-mesa-glx \
14
+ libglib2.0-0 \
15
  && rm -rf /var/lib/apt/lists/*
16
 
17
+ # Copy application files
 
 
 
 
 
 
 
 
 
18
  COPY . .
19
 
20
+ # Expose the port Flask runs on
21
  EXPOSE 7860
22
 
23
+ # Set environment variables for better CPU performance
24
+ ENV TOKENIZERS_PARALLELISM=false \
25
+ TRANSFORMERS_OFFLINE=1 \
26
+ HF_DATASETS_OFFLINE=1
27
+
28
+ # Run the application using Gunicorn with multiple workers
29
  CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:7860", "app:app"]