Prerequisites
Before building PentAGI from source, ensure you have the following installed:Backend Requirements
- Go 1.24.1 or later - Download
- GCC/G++ - C compiler for CGO dependencies
- Make - Build automation tool
- Git - Version control
Frontend Requirements
- Node.js 23 or later - Download
- npm - Comes with Node.js
- 4GB+ RAM - For Vite build process
Docker Image Requirements
- Docker - Install Docker
- 20GB+ free disk space - For build layers and images
Building the Backend
The backend is written in Go and consists of the main application and three testing utilities.Quick Build
Backend Dependencies
The backend uses Go modules for dependency management. Key dependencies include:- GraphQL:
github.com/99designs/gqlgenv0.17.57 - GraphQL server - Web Framework:
github.com/gin-gonic/ginv1.10.0 - HTTP web framework - Database:
github.com/jackc/pgx/v5v5.7.2 - PostgreSQL driver - Docker Client:
github.com/docker/dockerv28.3.3 - Container management - AI/LLM:
github.com/vxcontrol/langchaingo- LLM integration - Vector Store:
github.com/pgvector/pgvector-gov0.1.1 - pgvector support - Observability: OpenTelemetry SDKs for metrics, traces, and logs
backend/go.mod for the complete list of 230+ dependencies.
Build Flags
The-trimpath flag removes file system paths from compiled binaries for reproducible builds.
Building the Frontend
The frontend is a React + TypeScript application built with Vite.Quick Build
Frontend Dependencies
The frontend uses npm for package management. Key dependencies include: Core Framework:reactv19.0.0 - UI libraryreact-domv19.0.0 - React DOM renderertypescriptv5.6.2 - Type safetyvitev7.0.0 - Build tool and dev server
@apollo/clientv3.13.8 - GraphQL clientgraphqlv16.11.0 - GraphQL implementationgraphql-wsv6.0.5 - WebSocket subscriptionsaxiosv1.13.5 - HTTP client
@radix-ui/*- Accessible UI componentslucide-reactv0.553.0 - Icon library@xterm/xtermv5.5.0 - Terminal emulatorreact-markdownv10.1.0 - Markdown rendering
@tanstack/react-tablev8.21.3 - Table managementreact-hook-formv7.56.4 - Form handlingzodv3.25.32 - Schema validation
frontend/package.json for the complete list of 75+ dependencies.
Available Scripts
Building Docker Images
PentAGI uses a multi-stage Dockerfile for efficient image builds.Docker Build Process
The Dockerfile consists of three stages:-
Frontend Build Stage (
fe-build)- Base:
node:23-slim - Builds React frontend with Vite
- Output:
/frontend/dist
- Base:
-
Backend Build Stage (
be-build)- Base:
golang:1.24-bookworm - Builds Go backend and testing tools
- Output:
/pentagi,/ctester,/etester,/ftester
- Base:
-
Final Runtime Stage
- Base:
alpine:3.23.3 - Minimal runtime with binaries and static files
- Non-root user:
pentagi
- Base:
Building the Image
Build Optimizations
The Dockerfile includes several optimizations:- Layer Caching: Dependencies are cached separately from source code
- Parallel Builds: Frontend and backend build in parallel stages
- Minimal Runtime: Alpine Linux base (~5MB) for small final image
- Build Cache Mounts: Go modules and npm cache are mounted during build
Image Structure
The final image has the following structure:Entrypoint Script
The Docker image uses an entrypoint script (entrypoint.sh) that:
- Checks for existing SSL certificates
- Generates self-signed certificates if needed
- Sets proper file permissions
- Launches the PentAGI application
entrypoint.sh for details.
Build Troubleshooting
Backend Build Issues
Missing dependencies error
Missing dependencies error
CGO errors on Alpine Linux
CGO errors on Alpine Linux
Build taking too long
Build taking too long
Frontend Build Issues
Out of memory error
Out of memory error
GraphQL codegen errors
GraphQL codegen errors
Module not found errors
Module not found errors
Docker Build Issues
Build fails at frontend stage
Build fails at frontend stage
Permission denied errors
Permission denied errors
Cache issues
Cache issues