File size: 1,607 Bytes
efcd956
ba31b6c
 
efcd956
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
476ef85
 
 
efcd956
 
 
 
 
 
 
 
 
 
 
 
476ef85
eeac364
476ef85
efcd956
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
49
50
51
52
53
54
55
56
57
58
59
60
# Use an official Python runtime as a parent image
# FROM python:3.11-slim
FROM python:3.13-slim

WORKDIR /app  

# Set environment variables for Hugging Face cache
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 requirements.txt requirements.txt 
COPY static/ /app/static 
COPY app.py app.py
COPY medicationCategories/ /app/medicationCategories/ 
COPY reports/ /app/reports/ 
# COPY OUTPUTS/ /app/OUTPUTS
COPY . /app/
COPY . .

# Install system dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    gfortran \
    libblas-dev \
    liblapack-dev \
    libglib2.0-0 \
    libsm6 \
    libxext6 \
    libxrender-dev \
    tesseract-ocr \
    poppler-utils \
    libgl1 \
    curl \
    ca-certificates \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Ensure Cython is available before building mkl_fft
#RUN pip install cython && pip install mkl_fft --no-binary :all:

RUN pip install --upgrade pip && pip install -r requirements.txt

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

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

# Expose port and start application
EXPOSE 7860
CMD ["python", "app.py"]