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