Bc-AI commited on
Commit
f48d104
·
verified ·
1 Parent(s): 76aa792

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +47 -0
Dockerfile ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SharePUTER Worker Node — Docker Image for HF Spaces / Serverless Deployment
2
+ # Supports RAM, CPU, and GPU node types
3
+
4
+ FROM python:3.11-slim
5
+
6
+ # Set environment variables
7
+ ENV PYTHONUNBUFFERED=1 \
8
+ PYTHONDONTWRITEBYTECODE=1 \
9
+ SACCP_HEAD_URL="https://your-head-node.hf.space" \
10
+ SACCP_NODE_TYPE="CPU" \
11
+ SACCP_NODE_OWNER="anonymous" \
12
+ SACCP_AUTO_REGISTER="true" \
13
+ SPACE_HOST="https://your-worker.hf.space" \
14
+ PORT=7860
15
+
16
+ # Create non-root user (HF Spaces requirement)
17
+ RUN useradd -m -u 1000 user
18
+ WORKDIR /home/user/app
19
+
20
+ # Install system dependencies
21
+ RUN apt-get update && apt-get install -y --no-install-recommends \
22
+ gcc \
23
+ curl \
24
+ && rm -rf /var/lib/apt/lists/*
25
+
26
+ # Install Python dependencies
27
+ COPY requirements_worker.txt .
28
+ RUN pip install --no-cache-dir -r requirements_worker.txt
29
+
30
+ # Copy application
31
+ COPY worker_node.py .
32
+
33
+ # Change ownership
34
+ RUN chown -R user:user /home/user/app
35
+
36
+ # Switch to non-root user
37
+ USER user
38
+
39
+ # Expose port
40
+ EXPOSE 7860
41
+
42
+ # Health check
43
+ HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
44
+ CMD curl -f http://localhost:7860/health || exit 1
45
+
46
+ # Run the worker node
47
+ CMD ["uvicorn", "worker_node:app", "--host", "0.0.0.0", "--port", "7860"]