Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -725,14 +725,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); \
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
fi

docling: ## Start docling-serve for document processing
@echo "$(YELLOW)Starting docling-serve...$(NC)"
Expand Down
18 changes: 18 additions & 0 deletions frontend/build.js
Original file line number Diff line number Diff line change
@@ -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);
}
2 changes: 1 addition & 1 deletion frontend/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] {
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"scripts": {
"dev": "next dev",
"build": "next build",
"build": "node build.js",
"start": "next start",
"lint": "biome check .",
"typecheck": "tsc --noEmit",
Expand Down
Loading