Himanshu Gangwar commited on
Commit
51bbf4c
Β·
1 Parent(s): 1ebe8bf

remove docker files

Browse files
Files changed (7) hide show
  1. Dockerfile +0 -62
  2. Dockerfile.neo4j +0 -19
  3. Dockerfile.simple +0 -41
  4. docker-compose.yml +0 -35
  5. startup.sh +0 -60
  6. startup_simple.sh +0 -74
  7. test_local.sh +0 -83
Dockerfile DELETED
@@ -1,62 +0,0 @@
1
- # Hugging Face Space Dockerfile for MedGraphy
2
- # Runs Neo4j directly (no Docker-in-Docker)
3
- FROM python:3.10-slim
4
-
5
- # Set environment variables
6
- ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
7
- ENV PATH="${JAVA_HOME}/bin:${PATH}"
8
- ENV NEO4J_VERSION=5.15.0
9
- ENV NEO4J_HOME=/neo4j
10
- ENV NEO4J_URI=bolt://localhost:7687
11
- ENV NEO4J_USERNAME=neo4j
12
- ENV NEO4J_PASSWORD=neo4j
13
- ENV NEO4J_DATABASE=neo4j
14
- ENV GRADIO_SERVER_NAME=0.0.0.0
15
- ENV GRADIO_SERVER_PORT=7860
16
-
17
- # Install system dependencies including Java for Neo4j
18
- RUN apt-get update && apt-get install -y \
19
- wget \
20
- curl \
21
- git \
22
- build-essential \
23
- libgomp1 \
24
- openjdk-17-jre-headless \
25
- procps \
26
- ca-certificates \
27
- && rm -rf /var/lib/apt/lists/*
28
-
29
- # Download and install Neo4j using direct dist URL
30
- RUN mkdir -p ${NEO4J_HOME} && \
31
- cd ${NEO4J_HOME} && \
32
- wget --no-check-certificate -q "https://dist.neo4j.org/neo4j-community-${NEO4J_VERSION}-unix.tar.gz" -O neo4j.tar.gz && \
33
- tar -xzf neo4j.tar.gz --strip-components=1 && \
34
- rm neo4j.tar.gz && \
35
- mkdir -p ${NEO4J_HOME}/data ${NEO4J_HOME}/logs && \
36
- chmod -R 777 ${NEO4J_HOME}
37
-
38
- # Configure Neo4j - disable auth and set listen address
39
- RUN echo "server.default_listen_address=0.0.0.0" >> ${NEO4J_HOME}/conf/neo4j.conf && \
40
- echo "dbms.security.auth_enabled=false" >> ${NEO4J_HOME}/conf/neo4j.conf && \
41
- echo "server.bolt.listen_address=0.0.0.0:7687" >> ${NEO4J_HOME}/conf/neo4j.conf && \
42
- echo "server.http.listen_address=0.0.0.0:7474" >> ${NEO4J_HOME}/conf/neo4j.conf
43
-
44
- # Set working directory
45
- WORKDIR /app
46
-
47
- # Copy application files (requirements first for caching)
48
- COPY requirements.txt .
49
- RUN pip install --no-cache-dir --upgrade pip && \
50
- pip install --no-cache-dir -r requirements.txt
51
-
52
- # Copy the rest of the application
53
- COPY . .
54
-
55
- # Create data directory
56
- RUN mkdir -p data db /tmp/medgraph
57
-
58
- # Expose ports
59
- EXPOSE 7860 7474 7687
60
-
61
- # Run startup script
62
- CMD ["bash", "startup.sh"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Dockerfile.neo4j DELETED
@@ -1,19 +0,0 @@
1
- FROM neo4j:5.15.0
2
-
3
- # Set environment variables
4
- ENV NEO4J_AUTH=neo4j/medgraph123
5
- ENV NEO4J_dbms_security_procedures_unrestricted=apoc.*
6
- ENV NEO4J_dbms_security_procedures_allowlist=apoc.*
7
- ENV NEO4J_dbms_memory_heap_max__size=2G
8
- ENV NEO4J_dbms_memory_pagecache_size=1G
9
-
10
- # Install APOC plugin
11
- RUN apt-get update && apt-get install -y wget && \
12
- wget -P /var/lib/neo4j/plugins https://github.com/neo4j/apoc/releases/download/5.15.0/apoc-5.15.0-core.jar && \
13
- apt-get clean && rm -rf /var/lib/apt/lists/*
14
-
15
- # Expose Neo4j ports
16
- EXPOSE 7474 7687
17
-
18
- # Use default Neo4j entrypoint
19
- CMD ["neo4j"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Dockerfile.simple DELETED
@@ -1,41 +0,0 @@
1
- # Alternative Dockerfile without Docker-in-Docker
2
- # Use this if HF Spaces doesn't support Docker-in-Docker
3
- FROM python:3.10-slim
4
-
5
- # Install system dependencies including Java for Neo4j
6
- RUN apt-get update && apt-get install -y \
7
- wget \
8
- curl \
9
- git \
10
- openjdk-17-jre-headless \
11
- && rm -rf /var/lib/apt/lists/*
12
-
13
- # Set working directory
14
- WORKDIR /app
15
-
16
- # Copy application files
17
- COPY requirements.txt .
18
- RUN pip install --no-cache-dir -r requirements.txt
19
-
20
- COPY . .
21
-
22
- # Create data directory
23
- RUN mkdir -p data db
24
-
25
- # Make startup script executable
26
- RUN chmod +x startup_simple.sh
27
-
28
- # Expose ports
29
- EXPOSE 7860 7474 7687
30
-
31
- # Set environment variables
32
- ENV NEO4J_URI=bolt://localhost:7687
33
- ENV NEO4J_USERNAME=neo4j
34
- ENV NEO4J_PASSWORD=medgraph123
35
- ENV NEO4J_DATABASE=neo4j
36
- ENV GRADIO_SERVER_NAME=0.0.0.0
37
- ENV GRADIO_SERVER_PORT=7860
38
- ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
39
-
40
- # Run startup script
41
- CMD ["bash", "startup_simple.sh"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docker-compose.yml DELETED
@@ -1,35 +0,0 @@
1
- version: '3.8'
2
-
3
- services:
4
- neo4j:
5
- build:
6
- context: .
7
- dockerfile: Dockerfile.neo4j
8
- container_name: medgraph-neo4j
9
- ports:
10
- - "7474:7474" # HTTP
11
- - "7687:7687" # Bolt
12
- environment:
13
- - NEO4J_AUTH=neo4j/medgraph123
14
- - NEO4J_dbms_security_procedures_unrestricted=apoc.*
15
- - NEO4J_dbms_security_procedures_allowlist=apoc.*
16
- - NEO4J_dbms_memory_heap_max__size=2G
17
- - NEO4J_dbms_memory_pagecache_size=1G
18
- volumes:
19
- - neo4j_data:/data
20
- - neo4j_logs:/logs
21
- - neo4j_import:/var/lib/neo4j/import
22
- - neo4j_plugins:/plugins
23
- healthcheck:
24
- test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider localhost:7474 || exit 1"]
25
- interval: 10s
26
- timeout: 10s
27
- retries: 5
28
- start_period: 40s
29
- restart: unless-stopped
30
-
31
- volumes:
32
- neo4j_data:
33
- neo4j_logs:
34
- neo4j_import:
35
- neo4j_plugins:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
startup.sh DELETED
@@ -1,60 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- echo "πŸš€ Starting MedGraphy application..."
5
-
6
- # Create necessary directories
7
- mkdir -p /tmp/medgraph
8
-
9
- # Check if already initialized
10
- if [ -f "/tmp/medgraph/neo4j_initialized.flag" ]; then
11
- echo "βœ… Found existing Neo4j data marker"
12
- SKIP_INIT=true
13
- else
14
- echo "πŸ“Š First time setup - will initialize Neo4j with data..."
15
- SKIP_INIT=false
16
- fi
17
-
18
- # Start Neo4j directly
19
- echo "πŸš€ Starting Neo4j..."
20
- ${NEO4J_HOME}/bin/neo4j start
21
-
22
- # Wait for Neo4j to be ready
23
- echo "⏳ Waiting for Neo4j to be ready..."
24
- max_attempts=60
25
- attempt=0
26
- while [ $attempt -lt $max_attempts ]; do
27
- if curl -s http://localhost:7474 > /dev/null 2>&1; then
28
- echo "βœ… Neo4j is ready!"
29
- break
30
- fi
31
- attempt=$((attempt + 1))
32
- echo "Waiting... ($attempt/$max_attempts)"
33
- sleep 2
34
- done
35
-
36
- if [ $attempt -eq $max_attempts ]; then
37
- echo "⚠️ Neo4j failed to start within expected time"
38
- echo "πŸ“‹ Neo4j logs:"
39
- cat ${NEO4J_HOME}/logs/neo4j.log 2>/dev/null || echo "No logs available"
40
- echo "⚠️ Continuing with FAISS only..."
41
- fi
42
-
43
- # Initialize data if needed
44
- if [ "$SKIP_INIT" = false ]; then
45
- echo "πŸ“₯ Initializing Neo4j with medicine data..."
46
- python init_neo4j.py
47
-
48
- if [ $? -eq 0 ]; then
49
- echo "βœ… Neo4j initialization complete!"
50
- touch /tmp/medgraph/neo4j_initialized.flag
51
- else
52
- echo "⚠️ Neo4j initialization failed, continuing with FAISS only..."
53
- fi
54
- else
55
- echo "βœ… Using existing Neo4j data"
56
- fi
57
-
58
- # Start the Gradio application
59
- echo "🎨 Starting Gradio application..."
60
- exec python app.py
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
startup_simple.sh DELETED
@@ -1,74 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- echo "πŸš€ Starting MedGraphy with embedded Neo4j..."
5
-
6
- # Create necessary directories
7
- mkdir -p /tmp/neo4j/data /tmp/neo4j/logs /tmp/medgraph
8
-
9
- # Check if already initialized
10
- if [ -f "/tmp/medgraph/neo4j_initialized.flag" ]; then
11
- echo "βœ… Found existing Neo4j data marker"
12
- SKIP_INIT=true
13
- else
14
- echo "πŸ“Š First time setup - will initialize Neo4j"
15
- SKIP_INIT=false
16
- fi
17
-
18
- # Download and install Neo4j if not present
19
- if [ ! -d "/tmp/neo4j/neo4j-community" ]; then
20
- echo "πŸ“₯ Downloading Neo4j..."
21
- cd /tmp/neo4j
22
- wget -q https://dist.neo4j.org/neo4j-community-5.15.0-unix.tar.gz
23
- tar -xzf neo4j-community-5.15.0-unix.tar.gz
24
- mv neo4j-community-5.15.0 neo4j-community
25
- rm neo4j-community-5.15.0-unix.tar.gz
26
-
27
- # Configure Neo4j
28
- cd neo4j-community
29
- sed -i 's/#server.default_listen_address=0.0.0.0/server.default_listen_address=0.0.0.0/' conf/neo4j.conf
30
- sed -i 's/#initial.dbms.default_database=neo4j/initial.dbms.default_database=neo4j/' conf/neo4j.conf
31
-
32
- # Set password
33
- bin/neo4j-admin dbms set-initial-password medgraph123
34
- fi
35
-
36
- # Start Neo4j
37
- echo "πŸš€ Starting Neo4j..."
38
- cd /tmp/neo4j/neo4j-community
39
- bin/neo4j start
40
-
41
- # Wait for Neo4j to be ready
42
- echo "⏳ Waiting for Neo4j to be ready..."
43
- max_attempts=60
44
- attempt=0
45
- while [ $attempt -lt $max_attempts ]; do
46
- if curl -s http://localhost:7474 > /dev/null 2>&1; then
47
- echo "βœ… Neo4j is ready!"
48
- break
49
- fi
50
- attempt=$((attempt + 1))
51
- echo "Waiting... ($attempt/$max_attempts)"
52
- sleep 2
53
- done
54
-
55
- # Go back to app directory
56
- cd /app
57
-
58
- # Initialize data if needed
59
- if [ "$SKIP_INIT" = false ]; then
60
- echo "πŸ“₯ Initializing Neo4j with medicine data..."
61
- python init_neo4j.py
62
-
63
- if [ $? -eq 0 ]; then
64
- echo "βœ… Neo4j initialization complete!"
65
- touch /tmp/medgraph/neo4j_initialized.flag
66
- else
67
- echo "❌ Neo4j initialization failed!"
68
- exit 1
69
- fi
70
- fi
71
-
72
- # Start the Gradio application
73
- echo "🎨 Starting Gradio application..."
74
- exec python app.py
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
test_local.sh DELETED
@@ -1,83 +0,0 @@
1
- #!/bin/bash
2
- # Quick test script for local development
3
-
4
- echo "πŸ§ͺ MedGraphy Local Test Script"
5
- echo "================================"
6
-
7
- # Check if docker-compose is available
8
- if command -v docker-compose &> /dev/null; then
9
- echo "βœ… Docker Compose found"
10
- USE_DOCKER=true
11
- else
12
- echo "⚠️ Docker Compose not found - will use embedded Neo4j"
13
- USE_DOCKER=false
14
- fi
15
-
16
- # Check if Java is available (needed for embedded Neo4j)
17
- if ! $USE_DOCKER; then
18
- if ! command -v java &> /dev/null; then
19
- echo "❌ Java not found. Please install Java 17 or higher."
20
- echo " On Ubuntu/Debian: sudo apt-get install openjdk-17-jre-headless"
21
- echo " On macOS: brew install openjdk@17"
22
- exit 1
23
- else
24
- echo "βœ… Java found: $(java -version 2>&1 | head -n 1)"
25
- fi
26
- fi
27
-
28
- # Check for required files
29
- if [ ! -f "data/Medicine_Details.csv" ]; then
30
- echo "❌ Medicine_Details.csv not found in data/ directory"
31
- echo " Please copy it from MEDGraphy/data/ directory"
32
- exit 1
33
- fi
34
- echo "βœ… Data file found"
35
-
36
- # Check for environment variables
37
- if [ -z "$GROQ_API_KEY" ]; then
38
- echo "⚠️ GROQ_API_KEY not set"
39
- echo " Set it with: export GROQ_API_KEY=your_api_key"
40
- echo " Or create a .env file with GROQ_API_KEY=your_api_key"
41
- fi
42
-
43
- echo ""
44
- echo "πŸš€ Starting MedGraphy..."
45
- echo ""
46
-
47
- if $USE_DOCKER; then
48
- echo "Using Docker Compose method..."
49
-
50
- # Start Neo4j
51
- docker-compose up -d neo4j
52
-
53
- # Wait for Neo4j
54
- echo "Waiting for Neo4j to be ready..."
55
- sleep 5
56
- max_attempts=30
57
- attempt=0
58
- while [ $attempt -lt $max_attempts ]; do
59
- if curl -s http://localhost:7474 > /dev/null 2>&1; then
60
- echo "βœ… Neo4j is ready!"
61
- break
62
- fi
63
- attempt=$((attempt + 1))
64
- sleep 1
65
- done
66
-
67
- # Check if we need to initialize
68
- if [ ! -f "/tmp/medgraph/neo4j_initialized.flag" ]; then
69
- echo "πŸ“₯ Initializing Neo4j with data (this may take a few minutes)..."
70
- python init_neo4j.py
71
- mkdir -p /tmp/medgraph
72
- touch /tmp/medgraph/neo4j_initialized.flag
73
- else
74
- echo "βœ… Neo4j already initialized"
75
- fi
76
-
77
- # Start app
78
- echo "🎨 Starting Gradio app..."
79
- python app.py
80
- else
81
- echo "Using embedded Neo4j method..."
82
- bash startup_simple.sh
83
- fi