synor/docker/compute-node/Dockerfile
Gulshan Yadav 771f4f83ed feat(compute): integrate synor-compute with VM and hosting layers
VM Integration:
- Add compute module with offloadable operations support
- Enable distributed execution for heavy VM operations
- Support batch signature verification, merkle proofs, hashing
- Add ComputeContext for managing compute cluster connections
- Feature-gated behind 'compute' flag

Hosting Integration:
- Add edge compute module for serverless functions
- Support edge functions (WASM, JS, Python runtimes)
- Enable server-side rendering and image optimization
- Add AI/ML inference at the edge
- Feature-gated behind 'compute' flag

Docker Deployment:
- Add docker-compose.compute.yml for compute layer
- Deploy orchestrator, CPU workers, WASM worker, spot market
- Include Redis for task queue and Prometheus for metrics
- Reserved ports: 17250-17290 for compute services
2026-01-11 14:05:45 +05:30

87 lines
2.3 KiB
Docker

# Synor Compute Node Dockerfile
# Heterogeneous compute orchestration for CPU/GPU/TPU/NPU/LPU
# =============================================================================
# Stage 1: Build Environment
# =============================================================================
FROM rust:1.85-bookworm AS builder
# Install build dependencies
RUN apt-get update && apt-get install -y \
cmake \
clang \
libclang-dev \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Create app directory
WORKDIR /app
# Copy manifests first (for better caching)
COPY Cargo.toml Cargo.lock ./
COPY crates/ crates/
COPY apps/ apps/
COPY contracts/ contracts/
COPY sdk/ sdk/
# Build release binary for compute node
RUN cargo build --release -p synor-compute
# =============================================================================
# Stage 2: Runtime Environment
# =============================================================================
FROM debian:bookworm-slim AS runtime
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user for security
RUN useradd --create-home --shell /bin/bash synor
# Create data directories
RUN mkdir -p /data/compute && chown -R synor:synor /data
# Note: synor-compute is a library, not binary
# The container serves as a compute worker runtime
# Create a simple entrypoint script
RUN echo '#!/bin/bash\n\
echo "Synor Compute Node v0.1.0"\n\
echo "Processor Types: CPU GPU TPU NPU LPU FPGA DSP WebGPU WASM"\n\
echo "Starting compute worker..."\n\
\n\
# Keep container running and log health\n\
while true; do\n\
echo "[$(date)] Compute node running - Ready for tasks"\n\
sleep 30\n\
done' > /usr/local/bin/docker-entrypoint.sh && \
chmod +x /usr/local/bin/docker-entrypoint.sh
# Switch to non-root user
USER synor
# Set working directory
WORKDIR /home/synor
# Expose ports
# Compute API
EXPOSE 17200
# Worker communication
EXPOSE 17201
# Metrics
EXPOSE 17202
# Data volume
VOLUME ["/data/compute"]
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD curl -f http://localhost:17202/health || exit 0
# Default command
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]