sksameermujahid commited on
Commit
5b3323c
·
verified ·
1 Parent(s): 68ecda6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +33 -29
Dockerfile CHANGED
@@ -1,40 +1,44 @@
1
- FROM python:3.9
 
 
2
 
3
  # Install system dependencies
4
  RUN apt-get update && apt-get install -y \
5
- tesseract-ocr \
6
- tesseract-ocr-eng \
7
  && rm -rf /var/lib/apt/lists/*
8
 
9
- # Create a non-root user
10
- RUN useradd -m -u 1000 user
11
- USER user
12
- ENV PATH="/home/user/.local/bin:$PATH"
13
-
14
- # Set working directory
15
- WORKDIR /app
16
-
17
- # Copy requirements first to leverage Docker cache
18
- COPY --chown=user requirements.txt requirements.txt
19
-
20
- # Install Python dependencies
21
- RUN pip install --no-cache-dir --upgrade pip && \
22
- pip install --no-cache-dir -r requirements.txt
 
 
 
 
 
 
 
 
23
 
24
  # Download spaCy model
25
  RUN python -m spacy download en_core_web_md
26
 
27
- # Download sentence-transformers model
28
- RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('paraphrase-MiniLM-L6-v2')"
29
-
30
- # Copy the rest of the application
31
- COPY --chown=user . /app
32
-
33
- # Create necessary directories
34
- RUN mkdir -p /app/templates
35
 
36
- # Expose the port the app runs on
37
- EXPOSE 7860
38
 
39
- # Command to run the application
40
- CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--timeout", "120", "newapp:app"]
 
1
+ FROM python:3.9-slim
2
+
3
+ WORKDIR /app
4
 
5
  # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
+ build-essential \
8
+ git \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
+ # Install Python packages with specific versions
12
+ RUN pip install --no-cache-dir \
13
+ torch==2.0.1 \
14
+ transformers==4.30.2 \
15
+ sentence-transformers==2.2.2 \
16
+ huggingface-hub==0.16.4 \
17
+ accelerate==0.20.3 \
18
+ bitsandbytes==0.41.1 \
19
+ psutil==5.9.5 \
20
+ flask==2.3.3 \
21
+ flask-cors==4.0.0 \
22
+ pillow==10.0.0 \
23
+ numpy==1.24.3 \
24
+ pytesseract==0.3.10 \
25
+ langdetect==1.0.9 \
26
+ deep-translator==1.11.4 \
27
+ spacy==3.6.1 \
28
+ python-dotenv==1.0.0 \
29
+ requests==2.31.0 \
30
+ geopy==2.3.0 \
31
+ pyngrok==7.0.1 \
32
+ PyMuPDF==1.22.5
33
 
34
  # Download spaCy model
35
  RUN python -m spacy download en_core_web_md
36
 
37
+ # Copy application code
38
+ COPY . .
 
 
 
 
 
 
39
 
40
+ # Expose port
41
+ EXPOSE 5000
42
 
43
+ # Run the application
44
+ CMD ["python", "newapp.py"]