FROM python:3.10 | |
WORKDIR /code | |
# COPY ./requirements.txt /code/requirements.txt | |
COPY ./new_requirements.txt /code/new_requirements.txt | |
# RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
RUN pip install --no-cache-dir --upgrade -r /code/new_requirements.txt | |
# Install spaCy model | |
RUN python -m spacy download en_core_web_sm | |
# Patch SpaCy to use Pydantic v1 in case v2 is installed | |
RUN sed -i 's/from pydantic import ConstrainedStr/from pydantic.v1 import ConstrainedStr/' \ | |
/usr/local/lib/python3.10/site-packages/spacy/schemas.py | |
# Install Pydantic v1 and SpaCy explicitly to prevent version conflicts | |
# RUN pip install pydantic==1.10.12 spacy==3.5.3 | |
RUN pip install pydantic==1.10.12 | |
# Copy the local en_core_web_sm-3.0.0.tar.gz file into the container | |
# COPY ./en_core_web_sm-3.0.0.tar.gz /models/en_core_web_sm-3.0.0.tar.gz | |
# Install the spaCy model from the .tar.gz file | |
# RUN pip install /models/en_core_web_sm-3.0.0.tar.gz | |
# Clean up the .tar.gz file after installation | |
# RUN rm /models/en_core_web_sm-3.0.0.tar.gz | |
COPY . . | |
CMD ["waitress-serve", "--host", "0.0.0.0", "--port", "7860", "app:app"] |