FROM python:3.9 # Create user and set environment variables RUN useradd -m -u 1000 user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Switch to user and setup working directory USER user WORKDIR $HOME/app # First, copy just the requirements.txt and install dependencies COPY --chown=user ./requirements.txt $HOME/app/requirements.txt RUN pip install --user -r requirements.txt # Now copy the rest of the app COPY --chown=user . $HOME/app # Set the default command to run your application CMD ["chainlit", "run", "app.py", "--port", "7860"]