Spaces:
Running
Running
# 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"] |