Skip to content

Self-improving AI Employees for everyone

Add CPU-only Docker build and version sync from git tags

trohitgd29ab225eec9
diff --git a/client/package.json b/client/package.json
index 1ccbf22d..467904f4 100644
--- a/client/package.json
+++ b/client/package.json
@@ -1,7 +1,7 @@
{
"name": "react-flow-client",
"private": true,
- "version": "0.0.0",
+ "version": "0.0.11",
"type": "module",
"scripts": {
"start": "vite --host 0.0.0.0",
diff --git a/package.json b/package.json
index 856dca78..a7cfa4f1 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "machinaos",
- "version": "0.0.10",
+ "version": "0.0.11",
"description": "Open source workflow automation platform with AI agents, React Flow, and n8n-inspired architecture",
"type": "module",
"keywords": [
@@ -90,7 +90,8 @@
"daemon:start": "node scripts/daemon.js start",
"daemon:stop": "node scripts/daemon.js stop",
"daemon:restart": "node scripts/daemon.js restart",
- "prepublishOnly": "node -e \"const p=require('./package.json'); if(!p.bin||!p.version){process.exit(1)}\"",
+ "version:sync": "node scripts/sync-version.js",
+ "prepublishOnly": "node scripts/sync-version.js && node -e \"const p=require('./package.json'); if(!p.bin||!p.version){process.exit(1)}\"",
"postinstall": "node scripts/postinstall.js"
},
"dependencies": {
diff --git a/scripts/sync-version.js b/scripts/sync-version.js
new file mode 100644
index 00000000..6ba45e01
--- /dev/null
+++ b/scripts/sync-version.js
@@ -0,0 +1,108 @@
+#!/usr/bin/env node
+/**
+ * Syncs package.json version from the latest git tag.
+ *
+ * Usage:
+ * node scripts/sync-version.js # Sync from latest tag
+ * node scripts/sync-version.js v0.0.11 # Sync from specific tag
+ *
+ * This script:
+ * 1. Gets the latest git tag (or uses provided tag)
+ * 2. Strips the 'v' prefix to get semver version
+ * 3. Updates root package.json and client/package.json
+ */
+import { execSync } from 'child_process';
+import { readFileSync, writeFileSync } from 'fs';
+import { resolve, dirname } from 'path';
+import { fileURLToPath } from 'url';
+
+const __dirname = dirname(fileURLToPath(import.meta.url));
+const ROOT = resolve(__dirname, '..');
+
+function getLatestTag() {
+ try {
+ // Get the latest tag sorted by version
+ const tag = execSync('git describe --tags --abbrev=0', {
+ encoding: 'utf-8',
+ stdio: ['pipe', 'pipe', 'pipe'],
+ cwd: ROOT
+ }).trim();
+ return tag;
+ } catch {
+ // Fallback: list tags and get the latest by version sort
+ try {
+ const tags = execSync('git tag -l --sort=-version:refname', {
+ encoding: 'utf-8',
+ stdio: ['pipe', 'pipe', 'pipe'],
+ cwd: ROOT
+ }).trim().split('\n');
+ return tags[0] || null;
+ } catch {
+ return null;
+ }
+ }
+}
+
+function tagToVersion(tag) {
+ // Strip 'v' prefix if present: v0.0.11 -> 0.0.11
+ return tag.replace(/^v/, '');
+}
+
+function updatePackageJson(filePath, newVersion) {
+ const content = readFileSync(filePath, 'utf-8');
+ const pkg = JSON.parse(content);
+ const oldVersion = pkg.version;
+
+ if (oldVersion === newVersion) {
+ console.log(` ${filePath}: already at ${newVersion}`);
+ return false;
+ }
+
+ pkg.version = newVersion;
+ // Preserve formatting (2-space indent)
+ writeFileSync(filePath, JSON.stringify(pkg, null, 2) + '\n');
+ console.log(` ${filePath}: ${oldVersion} -> ${newVersion}`);
+ return true;
+}
+
+// Main
+const providedTag = process.argv[2];
+const tag = providedTag || getLatestTag();
+
+if (!tag) {
+ console.error('Error: No git tags found and no tag provided.');
+ console.error('Usage: node scripts/sync-version.js [tag]');
+ process.exit(1);
+}
+
+const version = tagToVersion(tag);
+
+if (!/^\d+\.\d+\.\d+/.test(version)) {
+ console.error(`Error: Invalid version format from tag "${tag}": "${version}"`);
+ console.error('Expected semver format like v0.0.11 or 0.0.11');
+ process.exit(1);
+}
+
+console.log(`Syncing version from tag: ${tag} -> ${version}\n`);
+
+const packageFiles = [
+ resolve(ROOT, 'package.json'),
+ resolve(ROOT, 'client', 'package.json'),
+];
+
+let updated = 0;
+for (const file of packageFiles) {
+ try {
+ if (updatePackageJson(file, version)) {
+ updated++;
+ }
+ } catch (err) {
+ console.error(` Error updating ${file}: ${err.message}`);
+ }
+}
+
+if (updated > 0) {
+ console.log(`\nUpdated ${updated} file(s). Don't forget to commit the changes.`);
+} else {
+ console.log('\nAll package.json files already at correct version.');
+}
diff --git a/server/Dockerfile b/server/Dockerfile
index 08549a49..f29ae4e3 100644
--- a/server/Dockerfile
+++ b/server/Dockerfile
@@ -1,4 +1,4 @@
-# Python FastAPI Backend
+# Python FastAPI Backend (CPU-only, no CUDA)
FROM python:3.12-slim
WORKDIR /app
@@ -10,13 +10,12 @@ RUN apt-get update && apt-get install -y \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
-COPY requirements.txt .
+# Use requirements-docker.txt which excludes CUDA-heavy dependencies
+COPY requirements-docker.txt .
-# Install Python dependencies
-RUN pip install --no-cache-dir -r requirements.txt
-
-# Install aiohttp for WebSocket client (Android relay)
-RUN pip install --no-cache-dir aiohttp>=3.9.0
+# Install Python dependencies (CPU-only)
+# This avoids sentence-transformers/PyTorch CUDA which adds ~5GB to image
+RUN pip install --no-cache-dir -r requirements-docker.txt
# Copy application code
COPY . .
diff --git a/server/requirements-docker.txt b/server/requirements-docker.txt
new file mode 100644
index 00000000..29209862
--- /dev/null
+++ b/server/requirements-docker.txt
@@ -0,0 +1,86 @@
+# Docker-specific requirements (CPU-only, no CUDA)
+# This file is used by Dockerfile to avoid large CUDA dependencies
+
+# Core Framework
+fastapi>=0.110.0
+uvicorn[standard]>=0.27.0
+
+# Performance optimization
+uvloop>=0.19.0;sys_platform!='win32'
+orjson>=3.10.0
+
+# Database & ORM (Python 3.13 compatible versions)
+sqlmodel>=0.0.18
+sqlalchemy[asyncio]>=2.0.35
+aiosqlite>=0.20.0
+
+# Settings & Configuration
+pydantic>=2.6.0
+pydantic-settings>=2.2.0
+python-dotenv>=1.0.0
+
+# Dependency Injection
+dependency-injector>=4.41.0
+
+# Caching (Redis) - Python 3.13 compatible
+redis>=5.0.0
+
+# HTTP Client
+httpx>=0.27.0
+
+# WebSocket Client (for WhatsApp RPC)
+websockets>=12.0
+
+# Async HTTP Client (for Android relay WebSocket)
+aiohttp>=3.9.0
+
+# QR Code Generation (for WhatsApp QR display)
+qrcode[pil]>=7.4.0
+
+# Logging
+structlog>=23.2.0
+
+# AI Providers (LangChain) - compatible versions
+langchain-core>=1.2.6
+langchain-openai>=1.0.0
+langchain-anthropic>=1.3.0
+langchain-google-genai>=3.1.0
+langchain-groq>=0.1.0
+langchain-cerebras>=0.1.0
+
+# LangGraph - State machine for AI agents
+langgraph>=1.0.6
+
+# Temporal - Durable workflow execution (optional)
+temporalio>=1.21.1
+
+# Google Services
+googlemaps>=4.10.0
+
+# Scheduling
+APScheduler>=3.10.0
+
+# Web Search
+ddgs>=9.0.0
+
+# Authentication
+bcrypt>=4.1.0
+python-jose[cryptography]>=3.3.0
+email-validator>=2.0.0
+
+# Timezone support
+pytz>=2024.1
+
+# Document Processing (CPU-only)
+beautifulsoup4>=4.12.0
+langchain-text-splitters>=0.3.0
+pypdf>=4.0.0
+
+# Note: The following are excluded for Docker builds (CUDA/GPU heavy):
+# - sentence-transformers (pulls PyTorch with CUDA)
+# - langchain-huggingface (pulls sentence-transformers)
+# - chromadb (pulls sentence-transformers for embeddings)
+# - qdrant-client (optional, can be re-added if needed without embeddings)
+#
+# For production with embeddings, use external embedding APIs (OpenAI, etc.)
+# or build a separate GPU-enabled image.
diff --git a/server/services/handlers/document.py b/server/services/handlers/document.py
index 9b47c14d..580d7a27 100644
--- a/server/services/handlers/document.py
+++ b/server/services/handlers/document.py
@@ -370,7 +370,10 @@ async def handle_embedding_generator(
logger.info("[embeddingGenerator] Starting", node_id=node_id, texts=len(texts), provider=provider)
if provider == 'huggingface':
- from langchain_huggingface import HuggingFaceEmbeddings
+ try:
+ from langchain_huggingface import HuggingFaceEmbeddings
+ except ImportError:
+ raise ImportError("HuggingFace embeddings not available. Install with: pip install langchain-huggingface sentence-transformers")
embedder = HuggingFaceEmbeddings(model_name=model)
elif provider == 'openai':
from langchain_openai import OpenAIEmbeddings
@@ -448,7 +451,10 @@ async def handle_vector_store(
async def _chroma_op(operation: str, params: Dict, collection: str) -> Dict:
"""ChromaDB operations."""
- import chromadb
+ try:
+ import chromadb
+ except ImportError:
+ raise ImportError("ChromaDB not available. Install with: pip install chromadb")
import uuid
persist_dir = params.get('persistDir', './data/vectors')
@@ -500,8 +506,11 @@ async def _chroma_op(operation: str, params: Dict, collection: str) -> Dict:
async def _qdrant_op(operation: str, params: Dict, collection: str) -> Dict:
"""Qdrant operations."""
- from qdrant_client import QdrantClient
- from qdrant_client.models import VectorParams, Distance, PointStruct
+ try:
+ from qdrant_client import QdrantClient
+ from qdrant_client.models import VectorParams, Distance, PointStruct
+ except ImportError:
+ raise ImportError("Qdrant client not available. Install with: pip install qdrant-client")
import uuid
url = params.get('qdrantUrl', 'http://localhost:6333')