# Use Python 3.11 slim as base image for the NZ Legislation Loophole Analysis Streamlit App FROM python:3.11-slim # Install system dependencies required for llama-cpp-python compilation and general app functionality RUN apt-get update && apt-get install -y \ build-essential \ cmake \ git \ && rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /app # Copy requirements file and install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the entire Streamlit application COPY streamlit_app/ ./streamlit_app/ # Copy data files (if needed for testing or default data) COPY nz-legislation.txt ./ # Create necessary directories for the Streamlit app RUN mkdir -p \ streamlit_app/cache \ streamlit_app/config \ streamlit_app/datasets \ streamlit_app/logs \ streamlit_app/uploads \ nz_legislation_dataset # Set environment variables for Streamlit ENV STREAMLIT_SERVER_HEADLESS=true ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false ENV STREAMLIT_SERVER_PORT=8501 ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0 # Expose the Streamlit port EXPOSE 8501 # Set working directory to the Streamlit app WORKDIR /app/streamlit_app # Set the default command to run the Streamlit application CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]