Added cuda requirements

This commit is contained in:
Viswamedha Nalabotu 2025-12-21 23:20:35 +00:00
parent be19245259
commit 5dee11b68b
2 changed files with 33 additions and 4 deletions

View file

@ -1,17 +1,39 @@
FROM python:3.11-slim FROM nvidia/cuda:11.8.0-runtime-ubuntu22.04
WORKDIR /app WORKDIR /app
RUN apt-get update && apt-get install -y \ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
python3 \
python3-pip \
build-essential \ build-essential \
git \ git \
&& rm -rf /var/lib/apt/lists/* ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& ln -sf /usr/bin/python3 /usr/bin/python \
&& ln -sf /usr/bin/pip3 /usr/bin/pip
COPY requirements/base.txt requirements/base.txt COPY requirements/base.txt requirements/base.txt
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
python3-dev \
libffi-dev \
libssl-dev \
cmake \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
RUN pip install --no-cache-dir -r requirements/base.txt && \ RUN pip install --no-cache-dir -r requirements/base.txt && \
pip install --no-cache-dir mcp gpt4all sentence-transformers chromadb pip install --no-cache-dir mcp gpt4all sentence-transformers chromadb
RUN if [ ! -e /usr/lib/x86_64-linux-gnu/libcudart.so.11.0 ]; then \
found=$(ls /usr/local/cuda/lib64/libcudart.so* 2>/dev/null | head -n1 || true); \
if [ -n "$found" ]; then \
mkdir -p /usr/lib/x86_64-linux-gnu || true; \
ln -sf "$found" /usr/lib/x86_64-linux-gnu/libcudart.so.11.0 || true; \
fi; \
fi
COPY apps /app/apps COPY apps /app/apps
COPY config /app/config COPY config /app/config
COPY mcp_agent /app/mcp_agent COPY mcp_agent /app/mcp_agent

View file

@ -24,16 +24,23 @@ services:
deploy: deploy:
mode: replicated mode: replicated
replicas: 1 replicas: 1
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
env_file: env_file:
- ../../.env - ../../.env
environment: environment:
- MCP_HTTP_HOST=0.0.0.0 - MCP_HTTP_HOST=0.0.0.0
- MCP_HTTP_PORT=8001 - MCP_HTTP_PORT=8001
- NVIDIA_VISIBLE_DEVICES=all
command: python -m mcp_agent.mcp_server command: python -m mcp_agent.mcp_server
volumes: volumes:
- ../../:/app - ../../:/app
- ${USERPROFILE}/.cache/gpt4all:/root/.cache/gpt4all:rw - ${USERPROFILE}/.cache/gpt4all:/root/.cache/gpt4all:rw
- ../../build/rag_db:/app/build/rag_db:ro - ../../build/rag_db:/app/build/rag_db
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.http.routers.fyp-mcp.rule=Host(`${MCP_DOMAIN}`)" - "traefik.http.routers.fyp-mcp.rule=Host(`${MCP_DOMAIN}`)"