FROM memgraph/memgraph-mage:latest # Force rebuild: 2026-03-20-21-20 USER root # 1. System Dependencies RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ curl git make g++ bash jq procps net-tools python3 python3-pip dos2unix ca-certificates gnupg \ && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ && apt-get install -y nodejs \ && rm -rf /var/lib/apt/lists/* # 2. Python Dependencies (Matching HuggingClaw success) RUN python3 -m pip install --no-cache-dir --break-system-packages \ huggingface_hub tomli tomli-w gqlalchemy pymgclient marimo plotly # 3. Install ZeroClaw RUN arch=$(uname -m) && \ if [ "$arch" = "x86_64" ]; then \ URL="https://github.com/zeroclaw-labs/zeroclaw/releases/latest/download/zeroclaw-x86_64-unknown-linux-gnu.tar.gz"; \ elif [ "$arch" = "aarch64" ]; then \ URL="https://github.com/zeroclaw-labs/zeroclaw/releases/latest/download/zeroclaw-aarch64-unknown-linux-gnu.tar.gz"; \ else \ echo "Unsupported architecture: $arch" && exit 1; \ fi && \ curl -fsSL "$URL" -o zeroclaw.tar.gz && \ tar -xzf zeroclaw.tar.gz && \ mv zeroclaw /usr/local/bin/zeroclaw && \ chmod +x /usr/local/bin/zeroclaw && \ rm zeroclaw.tar.gz WORKDIR /app # 4. Setup permissions for HF spaces user (UID 1000) RUN mkdir -p /app /home/node/.zeroclaw /home/node/.omniroute /var/log/memgraph /var/lib/memgraph /var/run/memgraph /etc/memgraph && \ chown -R 1000:1000 /app /home/node /var/log/memgraph /var/lib/memgraph /var/run/memgraph /etc/memgraph && \ chmod -R 777 /var/log/memgraph /var/lib/memgraph /var/run/memgraph /etc/memgraph USER 1000 # 5. Install Node.js dependencies COPY --chown=1000:1000 package*.json ./ RUN npm install # 6. Copy application files COPY --chown=1000:1000 scripts/ ./scripts/ COPY --chown=1000:1000 public/ ./public/ COPY --chown=1000:1000 config/ ./config/ COPY --chown=1000:1000 README.md ./README.md COPY --chown=1000:1000 VERSION ./VERSION # 7. Copy Pi agent and infrastructure # We use raw directories here, not zips, to avoid build complexity and security flags COPY --chown=1000:1000 agent-pi/ ./agent-pi/ COPY --chown=1000:1000 mom-infra/ ./mom-infra/ # 8. Make scripts executable and fix line endings RUN dos2unix /app/scripts/*.sh && \ chmod +x /app/scripts/*.sh # 9. Build mom-infra WORKDIR /app/mom-infra RUN npm install && npm run build WORKDIR /app # Set environment ENV PORT=7860 ENV GRAPH_VIEWER_PORT=7861 ENV OMNIROUTE_URL=http://localhost:20128/v1 ENV HOME=/home/node ENV NODE_OPTIONS="--max-old-space-size=1024" ENV MEMGRAPH_MEMORY_LIMIT="4GB" ENV MEMGRAPH_LICENSE_KEY="" # Expose ports EXPOSE 7860 7861 20128 7687 # Start all services via entrypoint ENTRYPOINT ["/bin/bash", "/app/scripts/entrypoint.sh"]