Spaces:
Sleeping
Sleeping
| 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 |