# Use the official Python image as base FROM python:3.9-slim # Create a non-root user RUN useradd -m -u 1000 user # Set the working directory in the container WORKDIR /app # Install system dependencies RUN apt-get update && \ apt-get install -y gcc python3-dev python3-venv && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* # Copy requirements file COPY --chown=user ./requirements.txt requirements.txt # Install dependencies RUN python3 -m venv env && \ /bin/bash -c "source env/bin/activate && pip install --no-cache-dir --upgrade -r requirements.txt" && \ /bin/bash -c "source env/bin/activate && pip install chainlit langchain_community" # Make port 7680 available to the world outside the container EXPOSE 7680 # Create the directory with appropriate permissions RUN mkdir -p /app/.files && \ chown -R user:user /app/.files # Copy the application code into the container COPY --chown=user . /app # Run the application CMD /bin/bash -c "source env/bin/activate && \ python3 downloadLLM.py && \ python3 ingest.py && \ chainlit run main.py --host 0.0.0.0 --port 7680"