suhail commited on
Commit
3e97a63
·
1 Parent(s): 64edec2
Files changed (2) hide show
  1. Dockerfile +15 -7
  2. src/mcp/__init__.py +2 -17
Dockerfile CHANGED
@@ -78,31 +78,39 @@
78
 
79
 
80
  # ////////////////////
81
-
82
-
83
  FROM python:3.11-slim
84
 
 
85
  WORKDIR /app
86
 
 
87
  RUN apt-get update && apt-get install -y \
88
  gcc \
89
  libpq-dev \
90
  postgresql-client \
91
  && rm -rf /var/lib/apt/lists/*
92
 
 
93
  COPY requirements.txt .
94
  RUN pip install --upgrade pip
95
  RUN pip install --no-cache-dir -r requirements.txt
96
 
97
- # Copy source
98
  COPY src/ ./src
99
 
100
- # FIXED: Alembic is inside src
101
- COPY src/alembic/ ./alembic/
102
  COPY alembic.ini .
103
 
104
- COPY specs/ /specs/
 
 
 
 
105
 
 
106
  EXPOSE 7860
107
 
108
- CMD alembic upgrade head && uvicorn src.main:app --host 0.0.0.0 --port 7860
 
 
78
 
79
 
80
  # ////////////////////
81
+ # Use slim Python 3.11 image
 
82
  FROM python:3.11-slim
83
 
84
+ # Set working directory inside container
85
  WORKDIR /app
86
 
87
+ # Install system dependencies
88
  RUN apt-get update && apt-get install -y \
89
  gcc \
90
  libpq-dev \
91
  postgresql-client \
92
  && rm -rf /var/lib/apt/lists/*
93
 
94
+ # Copy and install Python dependencies
95
  COPY requirements.txt .
96
  RUN pip install --upgrade pip
97
  RUN pip install --no-cache-dir -r requirements.txt
98
 
99
+ # Copy source code
100
  COPY src/ ./src
101
 
102
+ # Copy Alembic migrations and config
103
+ COPY src/alembic/ ./src/alembic/
104
  COPY alembic.ini .
105
 
106
+ # Copy specs (MCP tools contracts)
107
+ COPY specs/ ./specs/
108
+
109
+ # Set environment variable for working directory (optional, helps paths)
110
+ ENV PROJECT_ROOT=/app
111
 
112
+ # Expose port
113
  EXPOSE 7860
114
 
115
+ # Run migrations and start the app
116
+ CMD ["sh", "-c", "alembic upgrade head && uvicorn src.main:app --host 0.0.0.0 --port 7860 --reload"]
src/mcp/__init__.py CHANGED
@@ -20,23 +20,8 @@ logger = logging.getLogger(__name__)
20
 
21
 
22
  def load_tool_contract(tool_name: str) -> dict:
23
- """
24
- Load tool contract definition from JSON file.
25
-
26
- Args:
27
- tool_name: Name of the tool (e.g., "add_task")
28
-
29
- Returns:
30
- Tool contract dictionary
31
-
32
- Raises:
33
- FileNotFoundError: If contract file not found
34
- """
35
- # Get the project root directory
36
- current_file = Path(__file__)
37
- project_root = current_file.parent.parent.parent # backend/src/mcp -> backend
38
- contract_path = Path("C:/Users/Pcw/OneDrive/Desktop/phase-2-backend/taskflow-api/specs/001-openai-agent-mcp-tools/contracts") / f"{tool_name}.json"
39
-
40
 
41
  if not contract_path.exists():
42
  raise FileNotFoundError(f"Contract file not found: {contract_path}")
 
20
 
21
 
22
  def load_tool_contract(tool_name: str) -> dict:
23
+ project_root = Path("/app") # matches Docker WORKDIR
24
+ contract_path = project_root / "specs" / "001-openai-agent-mcp-tools" / "contracts" / f"{tool_name}.json"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  if not contract_path.exists():
27
  raise FileNotFoundError(f"Contract file not found: {contract_path}")