SyedHutter's picture
Download blenderbot_model via Docker
5e3fd94 verified
raw
history blame
802 Bytes
FROM python:3.9
# Set the working directory
WORKDIR /code
# Copy the requirements file and install dependencies
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Create a user and set environment variables
RUN useradd user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set the working directory for the user
WORKDIR $HOME/app
# Copy the application code and the model folder
COPY --chown=user . $HOME/app
COPY --chown=user ./en_core_web_sm-3.8.0 $HOME/app/en_core_web_sm-3.8.0
COPY --chown=user ./download_model.py $HOME/app/download_model.py
RUN python download_model.py # Downloads during build
# Set the command to run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]