sksameermujahid commited on
Commit
8653d40
·
verified ·
1 Parent(s): 216052a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -30
Dockerfile CHANGED
@@ -1,47 +1,29 @@
1
  FROM python:3.10-slim
2
 
3
- # Install system dependencies and build tools
 
 
4
  RUN apt-get update && apt-get install -y \
5
- tesseract-ocr \
6
- poppler-utils \
7
- libgl1-mesa-glx \
8
- libglib2.0-0 \
9
  build-essential \
10
- python3-dev \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
- # Set working directory
14
- WORKDIR /app
15
-
16
- # Create necessary directories with proper permissions
17
- RUN mkdir -p /app/logs /app/cache /.cache && \
18
- chmod -R 777 /app/logs /app/cache /.cache
19
-
20
  # Copy requirements first to leverage Docker cache
21
  COPY requirements.txt .
22
-
23
- # Install Python dependencies with verbose output
24
- RUN pip install --no-cache-dir -v -r requirements.txt
25
-
26
- # Install spaCy and its model in a separate step
27
- RUN pip install --no-cache-dir spacy==3.7.2 && \
28
- python -m spacy download en_core_web_md --user
29
 
30
  # Copy application code
31
  COPY . .
32
 
 
 
 
33
  # Set environment variables
34
- ENV PYTHONUNBUFFERED=1
35
- ENV PORT=8000
36
- ENV HOST=0.0.0.0
37
- ENV TRANSFORMERS_CACHE=/app/cache
38
- ENV LOG_DIR=/app/logs
39
- ENV HF_HOME=/app/cache
40
- ENV XDG_CACHE_HOME=/app/cache
41
- ENV SPACY_MODEL_DIR=/app/cache
42
 
43
  # Expose port
44
  EXPOSE 8000
45
 
46
- # Command to run the application
47
- CMD gunicorn --bind $HOST:$PORT app:app --timeout 120 --workers 2
 
1
  FROM python:3.10-slim
2
 
3
+ WORKDIR /app
4
+
5
+ # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
 
 
 
 
7
  build-essential \
8
+ libmagic1 \
9
  && rm -rf /var/lib/apt/lists/*
10
 
 
 
 
 
 
 
 
11
  # Copy requirements first to leverage Docker cache
12
  COPY requirements.txt .
13
+ RUN pip install --no-cache-dir -r requirements.txt
 
 
 
 
 
 
14
 
15
  # Copy application code
16
  COPY . .
17
 
18
+ # Create necessary directories
19
+ RUN mkdir -p static/uploads
20
+
21
  # Set environment variables
22
+ ENV FLASK_APP=app.py
23
+ ENV FLASK_ENV=production
 
 
 
 
 
 
24
 
25
  # Expose port
26
  EXPOSE 8000
27
 
28
+ # Run the application
29
+ CMD ["gunicorn", "--bind", "0.0.0.0:8000", "app:app"]