WebashalarForML commited on
Commit
b3c8dfa
·
verified ·
1 Parent(s): 77f14d0

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -22
Dockerfile CHANGED
@@ -1,10 +1,9 @@
1
- # Use an official Python runtime as a parent image
2
- # FROM python:3.11-slim
3
- FROM python:3.13-slim
4
 
5
  WORKDIR /app
6
 
7
- # Set environment variables for Hugging Face cache
8
  ENV DEBIAN_FRONTEND=noninteractive \
9
  PYTHONUNBUFFERED=1 \
10
  PYTHONDONTWRITEBYTECODE=1 \
@@ -13,25 +12,16 @@ ENV DEBIAN_FRONTEND=noninteractive \
13
  NLTK_DATA=/app/nltk_data \
14
  MPLCONFIGDIR=/app/.config/matplotlib
15
 
 
16
  COPY requirements.txt requirements.txt
17
  COPY static/ /app/static
18
  COPY app.py app.py
19
  COPY medicationCategories/ /app/medicationCategories/
20
  COPY reports/ /app/reports/
21
- # COPY OUTPUTS/ /app/OUTPUTS
22
  COPY . /app/
23
- COPY . .
24
 
25
- # Install system dependencies
26
  RUN apt-get update && apt-get install -y \
27
- build-essential \
28
- gfortran \
29
- libblas-dev \
30
- liblapack-dev \
31
- libglib2.0-0 \
32
- libsm6 \
33
- libxext6 \
34
- libxrender-dev \
35
  tesseract-ocr \
36
  poppler-utils \
37
  libgl1 \
@@ -40,21 +30,18 @@ RUN apt-get update && apt-get install -y \
40
  && apt-get clean \
41
  && rm -rf /var/lib/apt/lists/*
42
 
43
- # # Ensure Cython is available before building mkl_fft
44
- # RUN pip install cython && pip install mkl_fft --no-binary :all:
45
-
46
  RUN pip install --upgrade pip && pip install -r requirements.txt
47
 
48
- # Create necessary directories with correct permissions
49
  RUN mkdir -p /app/nltk_data /app/.config/matplotlib \
50
  && mkdir -p /app/cache /app/data /app/logs /app/static \
51
  && chmod -R 777 /app/cache /app/data /app/logs /app/static /app/medicationCategories /app/reports \
52
  && chmod -R 777 /app
53
 
54
- # Set Flask environment variables
55
  ENV FLASK_APP=app.py \
56
  FLASK_ENV=production
57
 
58
- # Expose port and start application
59
  EXPOSE 7860
60
- CMD ["python", "app.py"]
 
1
+ # Use Python 3.11 for best library compatibility
2
+ FROM python:3.11-slim
 
3
 
4
  WORKDIR /app
5
 
6
+ # Environment variables
7
  ENV DEBIAN_FRONTEND=noninteractive \
8
  PYTHONUNBUFFERED=1 \
9
  PYTHONDONTWRITEBYTECODE=1 \
 
12
  NLTK_DATA=/app/nltk_data \
13
  MPLCONFIGDIR=/app/.config/matplotlib
14
 
15
+ # Copy files
16
  COPY requirements.txt requirements.txt
17
  COPY static/ /app/static
18
  COPY app.py app.py
19
  COPY medicationCategories/ /app/medicationCategories/
20
  COPY reports/ /app/reports/
 
21
  COPY . /app/
 
22
 
23
+ # Install only the dependencies your app needs
24
  RUN apt-get update && apt-get install -y \
 
 
 
 
 
 
 
 
25
  tesseract-ocr \
26
  poppler-utils \
27
  libgl1 \
 
30
  && apt-get clean \
31
  && rm -rf /var/lib/apt/lists/*
32
 
33
+ # Install Python packages
 
 
34
  RUN pip install --upgrade pip && pip install -r requirements.txt
35
 
36
+ # Create app directories with permissions
37
  RUN mkdir -p /app/nltk_data /app/.config/matplotlib \
38
  && mkdir -p /app/cache /app/data /app/logs /app/static \
39
  && chmod -R 777 /app/cache /app/data /app/logs /app/static /app/medicationCategories /app/reports \
40
  && chmod -R 777 /app
41
 
42
+ # Flask environment
43
  ENV FLASK_APP=app.py \
44
  FLASK_ENV=production
45
 
 
46
  EXPOSE 7860
47
+ CMD ["python", "app.py"]