File size: 1,177 Bytes
f48d104 ee3a6f0 f48d104 ee3a6f0 f48d104 f1cf727 f48d104 ee3a6f0 f48d104 ee3a6f0 | 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 | # SharePUTER Worker Node — Docker Image for HF Spaces / Serverless Deployment
# Supports RAM, CPU, and GPU node types
FROM python:3.11-slim
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
SACCP_HEAD_URL="https://bc-ai-saccp-head.hf.space" \
SACCP_NODE_TYPE="CPU" \
SACCP_NODE_OWNER="anonymous" \
SACCP_AUTO_REGISTER="true" \
SPACE_HOST="https://bc-ai-node-test.hf.space" \
PORT=7860
# Create non-root user (HF Spaces requirement)
RUN useradd -m -u 1000 user
WORKDIR /home/user/app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application
COPY app.py .
# Change ownership
RUN chown -R user:user /home/user/app
# Switch to non-root user
USER user
# Expose port
EXPOSE 7860
# Health check
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
# Run the worker node
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |