FROM python:3.10-slim RUN useradd user # Switch to the "user" user USER user 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 contents into the container at $HOME/app setting the owner to the user COPY --chown=user . $HOME/app RUN pip install --upgrade pip RUN pip install -r requirements.txt CMD fastapi run --reload --host=0.0.0.0 --port=7860