FROM python:3.9.6 # Create a non-root user RUN useradd -m appuser WORKDIR /app # Copy app files COPY . /app RUN apt-get update && apt-get install -y \ build-essential \ curl \ software-properties-common \ git \ && rm -rf /var/lib/apt/lists/* # COPY requirements.txt ./ # Install dependencies RUN pip install --upgrade pip \ && pip install -r requirements.txt # Set the HOME env to a writable path (this is the key!) ENV HOME=/app ENV STREAMLIT_HOME=/app/.streamlit # Create .streamlit dir and set permissions RUN mkdir -p /app/.streamlit && \ chown -R appuser:appuser /app # Switch to non-root user USER appuser EXPOSE 8501 ENTRYPOINT ["streamlit", "run", "src/chatbot_frontend.py", "--server.port=8501", "--server.address=0.0.0.0"]