FROM python:3.9 # Create a new user with UID 1000 RUN useradd -m -u 1000 user # Switch to the new user USER user # Set environment variables ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Set the working directory WORKDIR $HOME/app # Copy the application code and change ownership to the new user COPY --chown=user . $HOME/app # Copy the requirements file separately COPY /requirements.txt /app/requirements.txt # Install the dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the application code COPY . . # Expose the port Chainlit will run on EXPOSE 7860 # Run the Chainlit application CMD ["chainlit", "run", "app.py", "--port", "7860"]