WebashalarForML's picture
Create Dockerfile
efcd956 verified
raw
history blame
1.45 kB
# Use an official Python runtime as a parent image
FROM python:3.11-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 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
tesseract-ocr \
poppler-utils \
libgl1 \
# ffmpeg \
# libopencv-dev \
curl \
ca-certificates \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
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"]