File size: 1,264 Bytes
29e73e7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM node:20-slim

# Install git
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /app

# Clone the repository
RUN git clone https://github.com/vishalmysore/agentWorkBook.git .

# Install dependencies
RUN npm ci --only=production

# Create directory for Gun.js agent data
RUN mkdir -p radata-validator

# Expose port 7860 (Hugging Face Spaces default)
EXPOSE 7860

# Set environment variable for Hugging Face Spaces
ENV PORT=7860

# Health check - verify agent is responsive
HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
    CMD node -e "require('http').get('http://localhost:7860/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))"

# Start health server in background and run AI validator agent
CMD node -e "const express = require('express'); \
    const app = express(); \
    app.get('/', (req,res) => res.json({status: 'running', agent: process.env.AGENT_NAME || 'AI-Validator', uptime: process.uptime()})); \
    app.get('/health', (req,res) => res.json({status: 'ok', agent: process.env.AGENT_NAME || 'AI-Validator', timestamp: Date.now()})); \
    app.listen(7860, () => console.log('✅ Health endpoint ready on :7860'));" & \
    node ai-validator-agent.js