FROM python:3.9-slim RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app COPY --chown=user . $HOME/app COPY ./requirements.txt ~/app/requirements.txt USER root RUN rm /var/lib/apt/lists/* -vf RUN apt-get clean RUN apt-get update RUN apt-get upgrade RUN apt-get install -y wget zip unzip uvicorn USER user COPY . . USER root RUN chmod 777 ~/app/* USER user RUN pip3 install -r requirements.txt EXPOSE 7860 CMD ["python", "app.py"]