mike23415 commited on
Commit
2f0cc7d
·
verified ·
1 Parent(s): 3b4df89

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -16
Dockerfile CHANGED
@@ -1,29 +1,29 @@
1
- # Use an official Python runtime as a parent image
2
- FROM python:3.9
3
 
4
  # Set the working directory inside the container
5
  WORKDIR /app
6
 
7
- # Set environment variables for Hugging Face cache
8
- ENV HF_HOME=/app/cache
9
- RUN mkdir -p /app/cache && chmod -R 777 /app/cache
 
 
10
 
11
- # Install system dependencies
12
- RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
 
13
 
14
  # Install Python dependencies
15
- COPY requirements.txt .
16
- RUN pip install --no-cache-dir --upgrade pip && \
17
- pip install --no-cache-dir -r requirements.txt
18
 
19
  # Copy the application code
20
  COPY . .
21
 
22
- # Expose the port for running the app (modify if needed)
23
  EXPOSE 7860
24
 
25
- # Ensure the script is executable
26
- RUN chmod +x /app/app.py
27
-
28
- # Run the application
29
- CMD ["python", "app.py"]
 
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"]