csepartha commited on
Commit
2b8669f
·
verified ·
1 Parent(s): 41c4c69

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +13 -9
  2. README.md +1 -0
  3. demo.launcher +11 -2
Dockerfile CHANGED
@@ -1,26 +1,30 @@
1
  FROM ubuntu:22.04
2
 
3
- # System deps
4
  RUN apt-get update && apt-get install -y curl sqlite3 python3 python3-pip
5
 
6
  # Install Ollama
7
  RUN curl -fsSL https://ollama.com/install.sh | sh
8
 
9
- # Copy python deps
10
  COPY requirements.txt .
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
- # Copy only the necessary files (e.g., server, client, and launcher scripts)
14
- COPY server.py client.py demo.launcher demo.db ./
15
 
16
- # Create a non-root user and avoid problematic directories (do this after copying files)
17
- RUN useradd -ms /bin/bash user && chown -R user:user ./server.py ./client.py ./demo.launcher ./demo.db
18
 
19
- # Expose port for Gradio
20
- EXPOSE 7860
21
 
 
22
  USER user
23
 
24
- # Start the application (run your launcher script)
 
 
 
25
  CMD ["./demo.launcher"]
26
 
 
1
  FROM ubuntu:22.04
2
 
3
+ # System dependencies
4
  RUN apt-get update && apt-get install -y curl sqlite3 python3 python3-pip
5
 
6
  # Install Ollama
7
  RUN curl -fsSL https://ollama.com/install.sh | sh
8
 
9
+ # Copy the requirements file and install Python dependencies
10
  COPY requirements.txt .
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
+ # Copy project files into the container
14
+ COPY . ./
15
 
16
+ # Make sure the demo.launcher script is executable
17
+ RUN chmod +x demo.launcher
18
 
19
+ # Add a non-root user and change ownership of necessary files
20
+ RUN useradd -ms /bin/bash user && chown -R user:user ./server.py ./client.py ./demo.launcher ./requirements.txt ./demo.db
21
 
22
+ # Switch to the non-root user
23
  USER user
24
 
25
+ # Expose the port that Gradio will use
26
+ EXPOSE 7860
27
+
28
+ # Start the demo.launcher script to run everything
29
  CMD ["./demo.launcher"]
30
 
README.md CHANGED
@@ -9,6 +9,7 @@ pinned: false
9
  tags:
10
  - mcp-server-track
11
  ---
 
12
  # Ollama MCP Gradio Demo
13
 
14
  This Space runs a SQLite MCP server and Gradio client with Ollama and MCP tools, for the Gradio Agents & MCP Hackathon 2025.
 
9
  tags:
10
  - mcp-server-track
11
  ---
12
+
13
  # Ollama MCP Gradio Demo
14
 
15
  This Space runs a SQLite MCP server and Gradio client with Ollama and MCP tools, for the Gradio Agents & MCP Hackathon 2025.
demo.launcher CHANGED
@@ -1,12 +1,21 @@
1
  #!/bin/bash
2
- # Pull your Ollama model (can be moved to build if desired)
 
 
3
  ollama pull granite3.1-moe
 
 
 
4
  ollama serve &
5
- sleep 5
 
 
6
 
7
  # Start MCP server in the background
 
8
  python3 server.py &
9
 
10
  # Start Gradio (client.py) on 0.0.0.0:7860
 
11
  python3 client.py --server_name 0.0.0.0 --server_port 7860
12
 
 
1
  #!/bin/bash
2
+
3
+ # Ensure that Ollama model is pulled
4
+ echo "Pulling Ollama model (granite3.1-moe)..."
5
  ollama pull granite3.1-moe
6
+
7
+ # Start the Ollama API server in the background
8
+ echo "Starting Ollama API server..."
9
  ollama serve &
10
+
11
+ # Wait for Ollama server to be ready (increase the sleep time if needed)
12
+ sleep 10
13
 
14
  # Start MCP server in the background
15
+ echo "Starting MCP server..."
16
  python3 server.py &
17
 
18
  # Start Gradio (client.py) on 0.0.0.0:7860
19
+ echo "Starting Gradio client..."
20
  python3 client.py --server_name 0.0.0.0 --server_port 7860
21