Skip to content

OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.

Python

fix: add ppc64le build and dev server support for frontend (#2101)

ethanchoe-22f576b8281da
diff --git a/Makefile b/Makefile
index 8cd6a7547..394319e32 100644
--- a/Makefile
+++ b/Makefile
@@ -726,14 +726,22 @@ backend: ## Run backend locally
frontend: ## Run frontend locally
@echo "$(YELLOW)Starting frontend locally...$(NC)"
@if [ ! -d "frontend/node_modules" ]; then echo "$(YELLOW)Installing frontend dependencies first...$(NC)"; cd frontend && npm install; fi
+ @ARCH=$$(uname -m); \
+ export ENV_FILE="$(abspath $(ENV_FILE))"; \
+ PORT=$${FRONTEND_PORT:-3000}; \
+ export NEXT_DIST_DIR=$${NEXT_DIST_DIR:-$$( [ "$$PORT" = "3000" ] && echo .next || echo .next-$$PORT )}; \
cd frontend && \
- export ENV_FILE="$(abspath $(ENV_FILE))"; \
- PORT=$${FRONTEND_PORT:-3000}; \
- export NEXT_DIST_DIR=$${NEXT_DIST_DIR:-$$( [ "$$PORT" = "3000" ] && echo .next || echo .next-$$PORT )}; \
- echo "$(YELLOW)Using distDir $$NEXT_DIST_DIR$(NC)"; \
+ echo "$(YELLOW)Using distDir $$NEXT_DIST_DIR$(NC)"; \
+ if [ "$$ARCH" = "ppc64le" ] || [ "$$ARCH" = "ppc64" ]; then \
+ echo "$(YELLOW)Detected Power architecture ($$ARCH) — using Webpack fallback$(NC)"; \
+ npx next dev --webpack \
+ --port $$PORT \
+ --hostname $$(hostname); \
+ else \
npx next dev \
--port $$PORT \
- --hostname $(hostname)
+ --hostname $$(hostname); \
+ fi
docling: ## Start docling-serve for document processing
@echo "$(YELLOW)Starting docling-serve...$(NC)"
diff --git a/frontend/build.js b/frontend/build.js
new file mode 100644
index 000000000..f7acfbc3f
--- /dev/null
+++ b/frontend/build.js
@@ -0,0 +1,18 @@
+#!/usr/bin/env node
+const { execSync } = require("child_process");
+
+// Detect architecture
+const arch = process.arch;
+const isPPC64 = arch === "ppc64";
+
+// Choose build command
+const buildCmd = isPPC64 ? "next build --webpack" : "next build";
+
+console.log(`Building for ${arch} using: ${buildCmd}`);
+
+// Execute build
+try {
+ execSync(buildCmd, { stdio: "inherit" });
+} catch (error) {
+ process.exit(error.status || 1);
+}
diff --git a/frontend/next.config.ts b/frontend/next.config.ts
index 47aec491d..6582603f7 100644
--- a/frontend/next.config.ts
+++ b/frontend/next.config.ts
@@ -6,7 +6,7 @@ import path from "path";
// the Makefile) so per-instance env files like `.env.instance2` are respected;
// defaults to `.env`. Absolute ENV_FILE paths are used as-is.
dotenv.config({
- path: path.resolve(__dirname, "..", process.env.ENV_FILE || ".env"),
+ path: path.resolve(process.cwd(), "..", process.env.ENV_FILE || ".env"),
});
function getAllowedDevOrigins(): string[] {
diff --git a/frontend/package.json b/frontend/package.json
index 445a436df..b4bf27cfb 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -7,7 +7,7 @@
},
"scripts": {
"dev": "next dev",
- "build": "next build",
+ "build": "node build.js",
"start": "next start",
"lint": "biome check .",
"typecheck": "tsc --noEmit",