VishalMysore commited on
Commit
29e73e7
·
verified ·
1 Parent(s): 770f1cc

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +34 -0
Dockerfile ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:20-slim
2
+
3
+ # Install git
4
+ RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
5
+
6
+ # Set working directory
7
+ WORKDIR /app
8
+
9
+ # Clone the repository
10
+ RUN git clone https://github.com/vishalmysore/agentWorkBook.git .
11
+
12
+ # Install dependencies
13
+ RUN npm ci --only=production
14
+
15
+ # Create directory for Gun.js agent data
16
+ RUN mkdir -p radata-validator
17
+
18
+ # Expose port 7860 (Hugging Face Spaces default)
19
+ EXPOSE 7860
20
+
21
+ # Set environment variable for Hugging Face Spaces
22
+ ENV PORT=7860
23
+
24
+ # Health check - verify agent is responsive
25
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
26
+ CMD node -e "require('http').get('http://localhost:7860/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))"
27
+
28
+ # Start health server in background and run AI validator agent
29
+ CMD node -e "const express = require('express'); \
30
+ const app = express(); \
31
+ app.get('/', (req,res) => res.json({status: 'running', agent: process.env.AGENT_NAME || 'AI-Validator', uptime: process.uptime()})); \
32
+ app.get('/health', (req,res) => res.json({status: 'ok', agent: process.env.AGENT_NAME || 'AI-Validator', timestamp: Date.now()})); \
33
+ app.listen(7860, () => console.log('✅ Health endpoint ready on :7860'));" & \
34
+ node ai-validator-agent.js