sksameermujahid commited on
Commit
d0594c5
·
verified ·
1 Parent(s): 8ef72cd

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -24
Dockerfile CHANGED
@@ -1,20 +1,13 @@
1
- FROM python:3.9-slim
2
 
3
  # Install system dependencies
4
  RUN apt-get update && apt-get install -y \
5
  tesseract-ocr \
6
- tesseract-ocr-eng \
7
  libgl1-mesa-glx \
8
  libglib2.0-0 \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
- # Create non-root user
12
- RUN useradd -m -u 1000 appuser
13
-
14
- # Create necessary directories with proper permissions
15
- RUN mkdir -p /app /app/logs /app/cache && \
16
- chown -R appuser:appuser /app
17
-
18
  # Set working directory
19
  WORKDIR /app
20
 
@@ -24,26 +17,16 @@ COPY requirements.txt .
24
  # Install Python dependencies
25
  RUN pip install --no-cache-dir -r requirements.txt
26
 
27
- # Download spaCy model
28
- RUN python -m spacy download en_core_web_md
29
-
30
  # Copy application code
31
- COPY --chown=appuser:appuser . .
32
 
33
  # Set environment variables
34
- ENV FLASK_APP=app.py
35
- ENV FLASK_ENV=production
36
  ENV PYTHONUNBUFFERED=1
37
- ENV CUDA_VISIBLE_DEVICES=""
38
- ENV TRANSFORMERS_CACHE="/app/cache"
39
- ENV HF_HOME="/app/cache"
40
- ENV XDG_CACHE_HOME="/app/cache"
41
-
42
- # Switch to non-root user
43
- USER appuser
44
 
45
  # Expose port
46
  EXPOSE 8000
47
 
48
- # Run the application with Gunicorn
49
- CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "4", "--timeout", "120", "app:app"]
 
1
+ FROM python:3.10-slim
2
 
3
  # Install system dependencies
4
  RUN apt-get update && apt-get install -y \
5
  tesseract-ocr \
6
+ poppler-utils \
7
  libgl1-mesa-glx \
8
  libglib2.0-0 \
9
  && rm -rf /var/lib/apt/lists/*
10
 
 
 
 
 
 
 
 
11
  # Set working directory
12
  WORKDIR /app
13
 
 
17
  # Install Python dependencies
18
  RUN pip install --no-cache-dir -r requirements.txt
19
 
 
 
 
20
  # Copy application code
21
+ COPY . .
22
 
23
  # Set environment variables
 
 
24
  ENV PYTHONUNBUFFERED=1
25
+ ENV PORT=8000
26
+ ENV HOST=0.0.0.0
 
 
 
 
 
27
 
28
  # Expose port
29
  EXPOSE 8000
30
 
31
+ # Command to run the application
32
+ CMD gunicorn --bind $HOST:$PORT app:app --timeout 120 --workers 2