Skip to content

Agent Zero AI framework

Local docker build

frdel602c4e379c4f
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 000000000..790ff9ed4
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,56 @@
+###############################################################################
+# Project‑specific exclusions / re‑includes
+###############################################################################
+
+# Large / generated data
+memory/**
+
+# Logs & tmp
+logs/*
+tmp/*
+
+# Knowledge directory – keep only default/
+knowledge/**
+!knowledge/default/
+!knowledge/default/**
+
+# Instruments directory – keep only default/
+instruments/**
+!instruments/default/
+!instruments/default/**
+
+# Keep .gitkeep markers anywhere
+!**/.gitkeep
+
+
+###############################################################################
+# Environment / tooling
+###############################################################################
+.conda/
+.cursor/
+.venv/
+.git/
+
+
+###############################################################################
+# Tests (root‑level only)
+###############################################################################
+/*.test.py
+
+
+###############################################################################
+# ─── LAST SECTION: universal junk / caches (MUST BE LAST) ───
+# Put these at the *bottom* so they override any ! re‑includes above
+###############################################################################
+# OS / editor junk
+**/.DS_Store
+**/Thumbs.db
+
+# Python caches / compiled artefacts
+**/__pycache__/
+**/*.py[cod]
+**/*.pyo
+**/*.pyd
+
+# Environment files anywhere
+*.env
diff --git a/.gitignore b/.gitignore
index c8377dbf0..17d47e1c8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,31 +4,15 @@
**/__pycache__/
**/.conda/
-# Ignore docker/run/agent-zero directory
-docker/run/agent-zero/
-
#Ignore cursor rules
.cursor/
# ignore test files in root dir
/*.test.py
-# Ignore git internal files (for bundler)
-.git/
-
# Ignore all contents of the virtual environment directory
.venv/
-# Handle bundle directory
-bundle/*/
-!bundle/mac_pkg_scripts
-
-# Handle work_dir directory
-work_dir/*
-
-# Handle specific docker directories
-docker/run/agent-zero/**
-
# Handle memory directory
memory/**
!memory/**/
diff --git a/DockerfileLocal b/DockerfileLocal
new file mode 100644
index 000000000..f934d9749
--- /dev/null
+++ b/DockerfileLocal
@@ -0,0 +1,36 @@
+# Use the pre-built base image for A0
+# FROM agent-zero-base:local
+FROM agent0ai/agent-zero-base:latest
+
+# Set BRANCH to "local" if not provided
+ARG BRANCH=local
+ENV BRANCH=$BRANCH
+
+# Copy filesystem files to root
+COPY ./docker/run/fs/ /
+# Copy current development files to git, they will only be used in "local" branch
+COPY ./ /git/agent-zero
+
+# pre installation steps
+RUN bash /ins/pre_install.sh $BRANCH
+
+# install A0
+RUN bash /ins/install_A0.sh $BRANCH
+
+# install additional software
+RUN bash /ins/install_additional.sh $BRANCH
+
+# cleanup repo and install A0 without caching, this speeds up builds
+ARG CACHE_DATE=none
+RUN echo "cache buster $CACHE_DATE" && bash /ins/install_A02.sh $BRANCH
+
+# post installation steps
+RUN bash /ins/post_install.sh $BRANCH
+
+# Expose ports
+EXPOSE 22 80 9000-9009
+
+RUN chmod +x /exe/initialize.sh /exe/run_A0.sh /exe/run_searxng.sh /exe/run_tunnel_api.sh
+
+# initialize runtime and switch to supervisord
+CMD ["/exe/initialize.sh", "$BRANCH"]
diff --git a/docker/run/Dockerfile b/docker/run/Dockerfile
index f2a0cfc0f..8941daf8c 100644
--- a/docker/run/Dockerfile
+++ b/docker/run/Dockerfile
@@ -7,7 +7,7 @@ ARG BRANCH
RUN if [ -z "$BRANCH" ]; then echo "ERROR: BRANCH is not set!" >&2; exit 1; fi
ENV BRANCH=$BRANCH
-# Copy contents of the project to /a0
+# Copy filesystem files to root
COPY ./fs/ /
# pre installation steps
diff --git a/docker/run/build.txt b/docker/run/build.txt
index 01b3e862e..bf1fba0f7 100644
--- a/docker/run/build.txt
+++ b/docker/run/build.txt
@@ -1,23 +1,32 @@
-# local image with smart cache
-docker build -t agent-zero:local --build-arg BRANCH=development --build-arg CACHE_DATE=$(date +%Y-%m-%d:%H:%M:%S) .
-# local image without cache
-docker build -t agent-zero:local --build-arg BRANCH=development --no-cache .
+# LOCAL BUILDS
+# Run these commands from the project root folder
+
+# local development image based on local files with smart cache
+docker build -f DockerfileLocal -t agent-zero-local --build-arg CACHE_DATE=$(date +%Y-%m-%d:%H:%M:%S) .
+
+# local development image based on local files without cache
+docker build -f DockerfileLocal -t agent-zero-local --no-cache .
+
+# local image based on testing branch instead of local files
+docker build -f ./docker/run/Dockerfile -t agent-zero-testing --build-arg BRANCH=testing .
# dockerhub push:
+# Run these commands from the project root folder
+
docker login
# development:
-docker buildx build --build-arg BRANCH=development -t agent0ai/agent-zero:development --platform linux/amd64,linux/arm64 --push --build-arg CACHE_DATE=$(date +%Y-%m-%d:%H:%M:%S) .
+docker buildx build -f ./docker/run/Dockerfile -t agent0ai/agent-zero:development --platform linux/amd64,linux/arm64 --push --build-arg BRANCH=development --build-arg CACHE_DATE=$(date +%Y-%m-%d:%H:%M:%S) ./docker/run
# testing:
-docker buildx build --build-arg BRANCH=testing -t agent0ai/agent-zero:testing --platform linux/amd64,linux/arm64 --push --build-arg CACHE_DATE=$(date +%Y-%m-%d:%H:%M:%S) .
+docker buildx build -f ./docker/run/Dockerfile -t agent0ai/agent-zero:testing --platform linux/amd64,linux/arm64 --push --build-arg BRANCH=testing --build-arg CACHE_DATE=$(date +%Y-%m-%d:%H:%M:%S) ./docker/run
# main
-docker buildx build --build-arg BRANCH=main -t agent0ai/agent-zero:vx.x.x -t agent0ai/agent-zero:latest --platform linux/amd64,linux/arm64 --push --build-arg CACHE_DATE=$(date +%Y-%m-%d:%H:%M:%S) .
+docker buildx build -f ./docker/run/Dockerfile -t agent0ai/agent-zero:vx.x.x -t agent0ai/agent-zero:latest --platform linux/amd64,linux/arm64 --push --build-arg BRANCH=main --build-arg CACHE_DATE=$(date +%Y-%m-%d:%H:%M:%S) ./docker/run
# plain output
diff --git a/docker/run/fs/ins/install_A0.sh b/docker/run/fs/ins/install_A0.sh
index 2033c232b..7b5d0d807 100644
--- a/docker/run/fs/ins/install_A0.sh
+++ b/docker/run/fs/ins/install_A0.sh
@@ -11,10 +11,20 @@ if [ -z "$1" ]; then
fi
BRANCH="$1"
-git clone -b "$BRANCH" "https://github.com/agent0ai/agent-zero" "/git/agent-zero" || {
- echo "CRITICAL ERROR: Failed to clone repository. Branch: $BRANCH"
- exit 1
-}
+if [ "$BRANCH" = "local" ]; then
+ # For local branch, use the files
+ echo "Using local dev files in /git/agent-zero"
+ # List all files recursively in the target directory
+ # echo "All files in /git/agent-zero (recursive):"
+ # find "/git/agent-zero" -type f | sort
+else
+ # For other branches, clone from GitHub
+ echo "Cloning repository from branch $BRANCH..."
+ git clone -b "$BRANCH" "https://github.com/agent0ai/agent-zero" "/git/agent-zero" || {
+ echo "CRITICAL ERROR: Failed to clone repository. Branch: $BRANCH"
+ exit 1
+ }
+fi
. "/ins/setup_venv.sh" "$@"
diff --git a/docker/run/fs/ins/install_A02.sh b/docker/run/fs/ins/install_A02.sh
index 66147ac17..d40132aa0 100644
--- a/docker/run/fs/ins/install_A02.sh
+++ b/docker/run/fs/ins/install_A02.sh
@@ -3,8 +3,10 @@ set -e
# cachebuster script, this helps speed up docker builds
-# remove repo
-rm -rf /git/agent-zero
+# remove repo (if not local branch)
+if [ "$1" != "local" ]; then
+ rm -rf /git/agent-zero
+fi
# run the original install script again
bash /ins/install_A0.sh "$@"
diff --git a/example.env b/example.env
deleted file mode 100644
index ce15a3b68..000000000
--- a/example.env
+++ /dev/null
@@ -1,28 +0,0 @@
-API_KEY_OPENAI=
-API_KEY_ANTHROPIC=
-API_KEY_GROQ=
-API_KEY_PERPLEXITY=
-API_KEY_GOOGLE=
-API_KEY_MISTRAL=
-API_KEY_OPENROUTER=
-API_KEY_SAMBANOVA=
-
-API_KEY_OPENAI_AZURE=
-OPENAI_AZURE_ENDPOINT=
-OPENAI_API_VERSION=
-
-HF_TOKEN=
-
-
-WEB_UI_PORT=50001
-USE_CLOUDFLARE=false
-
-
-OLLAMA_BASE_URL="http://127.0.0.1:11434"
-LM_STUDIO_BASE_URL="http://127.0.0.1:1234/v1"
-OPEN_ROUTER_BASE_URL="https://openrouter.ai/api/v1"
-SAMBANOVA_BASE_URL="https://fast-api.snova.ai/v1"
-
-
-TOKENIZERS_PARALLELISM=true
-PYDEVD_DISABLE_FILE_VALIDATION=1