Spaces:
Sleeping
Sleeping
| FROM python:3.13-bookworm | |
| # === Step 2.1: DECLARE THE BUILD ARGUMENT === | |
| # This line tells Docker to expect a build argument named GITHUB_PAT. | |
| ARG GITHUB_PAT | |
| # Install system dependencies | |
| # Use the headless version of openjdk-17, which is standard for server environments | |
| RUN apt-get update && \ | |
| apt-get install -y git curl openjdk-17-jre-headless nginx netcat-traditional && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Set JAVA_HOME (Good practice, though often not strictly necessary if Java is in the PATH) | |
| ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 | |
| # Download and install Neo4j Community Edition | |
| ENV NEO4J_VERSION=5.15.0 | |
| RUN curl -fsSL https://dist.neo4j.org/neo4j-community-5.15.0-unix.tar.gz -o neo4j.tar.gz && \ | |
| tar -xzf neo4j.tar.gz && \ | |
| mv neo4j-community-5.15.0 /neo4j && \ | |
| rm neo4j.tar.gz | |
| # Download and install the APOC plugin for Neo4j | |
| RUN curl -fsSL https://github.com/neo4j/apoc/releases/download/5.15.0/apoc-5.15.0-core.jar -o /neo4j/plugins/apoc.jar | |
| # Set workdir | |
| WORKDIR /app | |
| # === Step 2.2: USE THE BUILD ARGUMENT IN YOUR CLONE COMMAND === | |
| # Clone the project using the token for authentication | |
| RUN git clone https://oauth2:${GITHUB_PAT}@github.com/bhuvanmdev/graph-rag-agent.git /app | |
| # Create directories for Neo4j data and logs | |
| RUN mkdir -p /app/neo4j_data /app/neo4j_logs | |
| # === Correct Neo4j Configuration === | |
| RUN sed -i 's/#server.default_listen_address=127.0.0.1/server.default_listen_address=0.0.0.0/' /neo4j/conf/neo4j.conf && \ | |
| sed -i 's|#dbms.directories.data=data|dbms.directories.data=/app/neo4j_data|' /neo4j/conf/neo4j.conf && \ | |
| sed -i 's|#dbms.directories.logs=logs|dbms.directories.logs=/app/neo4j_logs|' /neo4j/conf/neo4j.conf && \ | |
| echo 'dbms.security.auth_enabled=false' >> /neo4j/conf/neo4j.conf | |
| # Install Python dependencies | |
| RUN pip install --upgrade pip && \ | |
| pip install -r requirements.txt | |
| # Install git-lfs, pull LFS files, and unzip. This will now work because the repo | |
| # was cloned with credentials. | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends git-lfs unzip && \ | |
| git lfs install && \ | |
| git lfs pull && \ | |
| unzip neo4j.zip && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Move the unzipped data | |
| RUN mv /app/neo4j_data/* /neo4j/data/ && mv /app/neo4j_logs/* /neo4j/logs/ | |
| # Copy Nginx config and run script | |
| COPY nginx.conf /etc/nginx/nginx.conf | |
| RUN chmod +x /app/scripts/run.sh | |
| # Expose HTTP (Nginx), Neo4j, and Gradio ports | |
| EXPOSE 8080 | |
| # Set Neo4j Home | |
| ENV NEO4J_HOME=/neo4j | |
| # Entrypoint: Start all services | |
| ENTRYPOINT ["/app/scripts/run.sh"] |