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 # Set the command to run the application CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]