File size: 1,303 Bytes
f5863be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Use Python 3.11 for best library compatibility
FROM python:3.13-slim

WORKDIR /app  

# Environment variables
ENV DEBIAN_FRONTEND=noninteractive \
    PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    TRANSFORMERS_CACHE=/app/cache \
    HF_HOME=/app/cache \
    NLTK_DATA=/app/nltk_data \
    MPLCONFIGDIR=/app/.config/matplotlib

# Copy files
COPY requirements.txt requirements.txt 
COPY static/ /app/static 
COPY app.py app.py
COPY medicationCategories/ /app/medicationCategories/ 
COPY reports/ /app/reports/ 
COPY . /app/

# Install only the dependencies your app needs
RUN apt-get update && apt-get install -y \
    tesseract-ocr \
    poppler-utils \
    libgl1 \
    curl \
    ca-certificates \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Install Python packages
RUN pip install --upgrade pip && pip install -r requirements.txt

# Create app directories with permissions
RUN mkdir -p /app/nltk_data /app/.config/matplotlib \
 && mkdir -p /app/cache /app/data /app/logs /app/static /app/tmp \
 && chmod -R 777 /app/cache /app/data /app/logs /app/static /app/medicationCategories /app/reports \
 && chmod -R 777 /app

# Flask environment
ENV FLASK_APP=app.py \
    FLASK_ENV=production

EXPOSE 7860
CMD ["python", "app.py"]