Spaces:
Sleeping
Sleeping
check docker
Browse files- Dockerfile +71 -0
Dockerfile
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.13-bookworm
|
| 2 |
+
|
| 3 |
+
# Install system dependencies
|
| 4 |
+
# Use the headless version of openjdk-17, which is standard for server environments
|
| 5 |
+
RUN apt-get update && \
|
| 6 |
+
apt-get install -y git curl openjdk-17-jre-headless nginx netcat-traditional && \
|
| 7 |
+
rm -rf /var/lib/apt/lists/*
|
| 8 |
+
|
| 9 |
+
# Set JAVA_HOME (Good practice, though often not strictly necessary if Java is in the PATH)
|
| 10 |
+
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
|
| 11 |
+
|
| 12 |
+
# Download and install Neo4j Community Edition
|
| 13 |
+
ENV NEO4J_VERSION=5.15.0
|
| 14 |
+
RUN curl -fsSL https://dist.neo4j.org/neo4j-community-5.15.0-unix.tar.gz -o neo4j.tar.gz && \
|
| 15 |
+
tar -xzf neo4j.tar.gz && \
|
| 16 |
+
mv neo4j-community-5.15.0 /neo4j && \
|
| 17 |
+
rm neo4j.tar.gz
|
| 18 |
+
|
| 19 |
+
# Download and install the APOC plugin for Neo4j
|
| 20 |
+
RUN curl -fsSL https://github.com/neo4j/apoc/releases/download/5.15.0/apoc-5.15.0-core.jar -o /neo4j/plugins/apoc.jar
|
| 21 |
+
|
| 22 |
+
# Set workdir
|
| 23 |
+
WORKDIR /app
|
| 24 |
+
|
| 25 |
+
RUN pwd
|
| 26 |
+
# Clone the project
|
| 27 |
+
RUN git clone https://github.com/bhuvanmdev/graph-rag-agent.git /app
|
| 28 |
+
|
| 29 |
+
# Create directories for Neo4j data and logs
|
| 30 |
+
# These directories can be bind mounted from the host
|
| 31 |
+
RUN mkdir -p /app/neo4j_data /app/neo4j_logs
|
| 32 |
+
|
| 33 |
+
# === Correct Neo4j Configuration ===
|
| 34 |
+
# Modify neo4j.conf directly instead of using ENV variables
|
| 35 |
+
# Note: Disabling authentication is not recommended for production
|
| 36 |
+
RUN sed -i 's/#server.default_listen_address=127.0.0.1/server.default_listen_address=0.0.0.0/' /neo4j/conf/neo4j.conf && \
|
| 37 |
+
sed -i 's|#dbms.directories.data=data|dbms.directories.data=/app/neo4j_data|' /neo4j/conf/neo4j.conf && \
|
| 38 |
+
sed -i 's|#dbms.directories.logs=logs|dbms.directories.logs=/app/neo4j_logs|' /neo4j/conf/neo4j.conf && \
|
| 39 |
+
echo 'dbms.security.auth_enabled=false' >> /neo4j/conf/neo4j.conf
|
| 40 |
+
|
| 41 |
+
# Install Python dependencies
|
| 42 |
+
RUN pip install --upgrade pip && \
|
| 43 |
+
pip install -r requirements.txt
|
| 44 |
+
|
| 45 |
+
RUN --mount=type=secret,id=github_pat \
|
| 46 |
+
apt-get update && \
|
| 47 |
+
apt-get install -y --no-install-recommends git-lfs unzip && \
|
| 48 |
+
export GIT_TOKEN=$(cat /run/secrets/github_pat) && \
|
| 49 |
+
git remote set-url origin https://oauth2:$GIT_TOKEN@github.com/bhuvanmdev/graph-rag-agent.git && \
|
| 50 |
+
git lfs install && \
|
| 51 |
+
git lfs pull && \
|
| 52 |
+
unzip neo4j_data.zip && \
|
| 53 |
+
rm -rf /var/lib/apt/lists/*
|
| 54 |
+
|
| 55 |
+
# we get neo4j_data and neo4j_logs with a lot of files from the zip file, now we move it to /neo4j/data and /neo4j/logs respectively.
|
| 56 |
+
RUN mv /app/neo4j_data/* /neo4j/data/ && mv /app/neo4j_logs/* /neo4j/logs/
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
# Copy Nginx config and run script
|
| 61 |
+
RUN cp nginx.conf /etc/nginx/nginx.conf
|
| 62 |
+
RUN chmod +x /app/scripts/run.sh
|
| 63 |
+
|
| 64 |
+
# Expose HTTP (Nginx), Neo4j, and Gradio ports
|
| 65 |
+
EXPOSE 80
|
| 66 |
+
|
| 67 |
+
# Set Neo4j Home
|
| 68 |
+
ENV NEO4J_HOME=/neo4j
|
| 69 |
+
|
| 70 |
+
# Entrypoint: Start all services
|
| 71 |
+
ENTRYPOINT ["/app/scripts/run.sh"]
|