File size: 1,620 Bytes
9434d3d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# EU AI Act - ChatGPT MCP Server
# Standalone MCP server for ChatGPT Apps integration
# Deploys ONLY the MCP tools (discover_organization, discover_ai_services, assess_compliance)

FROM node:20-slim

# Install Python, pnpm, and uv
RUN apt-get update && apt-get install -y \
    python3 \
    python3-venv \
    curl \
    && npm install -g pnpm \
    && curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR=/usr/local/bin sh \
    && rm -rf /var/lib/apt/lists/*

# Use existing node user (UID 1000) for HF Spaces compatibility
USER node
ENV HOME=/home/node

WORKDIR $HOME/app

# Copy entire monorepo
COPY --chown=node . .

# Install Node dependencies
RUN pnpm install --frozen-lockfile

# Build MCP server and Agent (needed for API)
RUN pnpm --filter @eu-ai-act/mcp-server build
RUN pnpm --filter @eu-ai-act/agent build

# Create Python venv and install dependencies
RUN uv venv $HOME/venv && \
    . $HOME/venv/bin/activate && \
    uv pip install --no-cache -r apps/eu-ai-act-agent/requirements.txt

# Environment
ENV NODE_ENV=production \
    PORT=3001 \
    API_URL=http://localhost:3001 \
    PUBLIC_URL=https://mcp-1st-birthday-eu-ai-act-chatgpt-mcp.hf.space \
    CHATGPT_APP_SERVER_NAME=0.0.0.0 \
    CHATGPT_APP_SERVER_PORT=7860 \
    PATH=/home/node/venv/bin:$PATH \
    VIRTUAL_ENV=/home/node/venv \
    MCP_SERVER_PATH=/home/node/app/packages/eu-ai-act-mcp/dist/index.js

WORKDIR $HOME/app/apps/eu-ai-act-agent

EXPOSE 7860

# Start API server + ChatGPT MCP App on port 7860
# MCP URL will be: PUBLIC_URL/gradio_api/mcp/
CMD node dist/server.js & \
    sleep 2 && \
    python src/chatgpt_app.py