nandini2455508's picture
Update Dockerfile
a7aa3c1 verified
FROM python:3.10
WORKDIR /code
# 1. Install system dependencies required for numpy
RUN apt-get update && apt-get install -y \
build-essential \
libatlas-base-dev \
gfortran \
libblas-dev \
liblapack-dev
# 2. Clean cache and install numpy first to lock ABI
RUN pip install --no-cache-dir numpy==1.23.5
# 3. Install spacy and thinc using binary wheels
RUN pip install --no-cache-dir spacy==3.5.4 thinc==8.1.10 && \
python -m spacy download en_core_web_sm
# 4. Copy requirements and install rest of the packages
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Setup NLTK
ENV NLTK_DATA=/code/nltk_data
RUN mkdir -p $NLTK_DATA && \
python -m nltk.downloader -d $NLTK_DATA stopwords wordnet
# 5. Copy all project files
COPY . .
# 6. Force reinstall numpy to ensure internal _core module is intact
RUN pip install --force-reinstall --no-cache-dir numpy==1.23.5
# 7. Debugging step: Verify numpy version
RUN python -c "import numpy; print('Numpy version:', numpy.__version__); print('Numpy location:', numpy.__file__)"
EXPOSE 7860
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"]