## Us the official python 3.9 FROM python:3.9 #set working directory to /code WORKDIR /code # copy the current directory contents in the container at /code COPY ./requirements.txt /code/ #install requirements.txt RUN pip install --no-cache-dir --upgrade -r requirements.txt #Set new user named "user" RUN useradd user #Switch to user the user USER user #Set home to the user home directory ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # set the working directory to the user's home directory WORKDIR $HOME/app #Copy the current directory into the container at $HOME/app setting the owner to the user COPY --chown=user . $HOME/app #START the fastapi app on the port 7860 CMD ["uvicorn","app:app","--host","0.0.0.0","--port","7860"]