maahi2412 commited on
Commit
4756959
·
verified ·
1 Parent(s): dd36399

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +53 -17
Dockerfile CHANGED
@@ -1,26 +1,62 @@
1
- FROM python:3.9-slim
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  RUN apt-get update && apt-get install -y \
4
- libpng-dev \
5
- libjpeg-dev \
6
- zlib1g-dev \
7
  tesseract-ocr \
8
  libtesseract-dev \
 
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
- RUN useradd -m -u 1000 user
12
- USER user
13
- ENV PATH="/home/user/.local/bin:$PATH"
14
-
15
- WORKDIR /app
16
-
17
- COPY --chown=user:user requirements.txt requirements.txt
18
- RUN pip install --no-cache-dir --upgrade pip && \
19
- pip install --no-cache-dir -r requirements.txt
20
 
21
- COPY --chown=user:user . /app
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
- EXPOSE 7860
 
24
 
25
- # Increase timeout and reduce workers
26
- CMD ["gunicorn", "--workers", "1", "--timeout", "600", "--bind", "0.0.0.0:7860", "app:app"]
 
1
+ # FROM python:3.9-slim
2
 
3
+ # RUN apt-get update && apt-get install -y \
4
+ # libpng-dev \
5
+ # libjpeg-dev \
6
+ # zlib1g-dev \
7
+ # tesseract-ocr \
8
+ # libtesseract-dev \
9
+ # && rm -rf /var/lib/apt/lists/*
10
+
11
+ # RUN useradd -m -u 1000 user
12
+ # USER user
13
+ # ENV PATH="/home/user/.local/bin:$PATH"
14
+
15
+ # WORKDIR /app
16
+
17
+ # COPY --chown=user:user requirements.txt requirements.txt
18
+ # RUN pip install --no-cache-dir --upgrade pip && \
19
+ # pip install --no-cache-dir -r requirements.txt
20
+
21
+ # COPY --chown=user:user . /app
22
+
23
+ # EXPOSE 7860
24
+
25
+ # # Increase timeout and reduce workers
26
+ # CMD ["gunicorn", "--workers", "1", "--timeout", "600", "--bind", "0.0.0.0:7860", "app:app"]
27
+
28
+ # Use an official Python runtime as the base image
29
+ FROM python:3.8-slim
30
+
31
+ # Set working directory
32
+ WORKDIR /app
33
+
34
+ # Install system dependencies (e.g., for pdfplumber, pytesseract)
35
  RUN apt-get update && apt-get install -y \
 
 
 
36
  tesseract-ocr \
37
  libtesseract-dev \
38
+ poppler-utils \
39
  && rm -rf /var/lib/apt/lists/*
40
 
41
+ # Copy application code
42
+ COPY . /app
 
 
 
 
 
 
 
43
 
44
+ # Install Python dependencies
45
+ RUN pip install --no-cache-dir \
46
+ flask \
47
+ flask-cors \
48
+ pdfplumber \
49
+ pillow \
50
+ pytesseract \
51
+ numpy \
52
+ torch \
53
+ transformers \
54
+ datasets \
55
+ scikit-learn \
56
+ gunicorn
57
 
58
+ # Expose port
59
+ EXPOSE 5000
60
 
61
+ # Run with Gunicorn
62
+ CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"]