maahi2412 commited on
Commit
539fd5b
·
verified ·
1 Parent(s): eb27057

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +58 -58
Dockerfile CHANGED
@@ -1,69 +1,69 @@
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
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
- # Create uploads and cache directories with proper permissions
59
- RUN mkdir -p /app/uploads /app/cache && \
60
- chmod -R 777 /app/uploads /app/cache
61
-
62
- # Set environment variable for Hugging Face cache
63
- ENV TRANSFORMERS_CACHE=/app/cache
64
-
65
- # Expose port
66
- EXPOSE 5000
67
-
68
- # Run with Gunicorn
69
- CMD ["gunicorn", "--bind", "0.0.0.0:5000", "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
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
+ # # Create uploads and cache directories with proper permissions
59
+ # RUN mkdir -p /app/uploads /app/cache && \
60
+ # chmod -R 777 /app/uploads /app/cache
61
+
62
+ # # Set environment variable for Hugging Face cache
63
+ # ENV TRANSFORMERS_CACHE=/app/cache
64
+
65
+ # # Expose port
66
+ # EXPOSE 5000
67
+
68
+ # # Run with Gunicorn
69
+ # CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"]