FROM python:3.9 # Create a non-root user RUN useradd -m -u 1000 user # Set the environment variables ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Set the working directory WORKDIR $HOME/app # Copy the requirements and install dependencies COPY --chown=user:user ./requirements.txt $HOME/app/requirements.txt RUN pip install -r requirements.txt # Copy the entire project and take ownership COPY --chown=user:user . $HOME/app # Create and adjust permissions for data directory RUN mkdir -p $HOME/app/data/embeddings && \ chown -R user:user $HOME/app/data # Use the non-root user to run the app USER user # Command to run the application CMD ["chainlit", "run", "app.py", "--port", "7860"]