# Use a slim Python image as a base FROM python:3.9-slim # Set the working directory in the container WORKDIR /app # Install system dependencies needed for some Python packages # RUN apt-get update && apt-get install -y \ # build-essential \ # curl \ # software-properties-common \ # git \ # && rm -rf /var/lib/apt/lists/* # Copy the requirements file first to leverage Docker cache COPY requirements.txt ./ # Install Python dependencies RUN pip3 install -r requirements.txt # This will copy streamlit_app.py, agents.py, the tools/ folder, etc. COPY . . # --- START: PERMISSION FIXES FOR HUGGING FACE SPACES --- # 1. Create the directories your application needs to write to at runtime. # Using /data is a common and clean convention for persistent/writable data. # The -p flag ensures parent directories are created if needed. RUN mkdir -p /app/vectordb/lancedb # 2. Change the ownership of these new data directories to be globally writable. # The 777 permission is broad, but very effective in hosted environments where # you don't know which user ID (e.g., uid=1000) will run the process. # This command says "any user can read, write, and execute in these folders". RUN chmod -R 777 /app/vectordb # --- END: PERMISSION FIXES --- # Expose the port Streamlit will run on. Your file uses 8501. EXPOSE 8501 # Set up a health check to see if the app is running HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health # Define the command to run when the container starts ENTRYPOINT ["streamlit", "run", "streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]