Local docker build

frdel committed Jul 29, 2025 at 12:52 UTC 602c4e379c4f9f31a1cd75876bc45a65686696eb
8 files changed +127 -58
.dockerignore new
+56
@@ -0,0 +1,56 @@
1 +###############################################################################
2 +# Project‑specific exclusions / re‑includes
3 +###############################################################################
4 +
5 +# Large / generated data
6 +memory/**
7 +
8 +# Logs & tmp
9 +logs/*
10 +tmp/*
11 +
12 +# Knowledge directory – keep only default/
13 +knowledge/**
14 +!knowledge/default/
15 +!knowledge/default/**
16 +
17 +# Instruments directory – keep only default/
18 +instruments/**
19 +!instruments/default/
20 +!instruments/default/**
21 +
22 +# Keep .gitkeep markers anywhere
23 +!**/.gitkeep
24 +
25 +
26 +###############################################################################
27 +# Environment / tooling
28 +###############################################################################
29 +.conda/
30 +.cursor/
31 +.venv/
32 +.git/
33 +
34 +
35 +###############################################################################
36 +# Tests (root‑level only)
37 +###############################################################################
38 +/*.test.py
39 +
40 +
41 +###############################################################################
42 +# ─── LAST SECTION: universal junk / caches (MUST BE LAST) ───
43 +# Put these at the *bottom* so they override any ! re‑includes above
44 +###############################################################################
45 +# OS / editor junk
46 +**/.DS_Store
47 +**/Thumbs.db
48 +
49 +# Python caches / compiled artefacts
50 +**/__pycache__/
51 +**/*.py[cod]
52 +**/*.pyo
53 +**/*.pyd
54 +
55 +# Environment files anywhere
56 +*.env
.gitignore
-16
@@ -4,31 +4,15 @@
4 **/__pycache__/
5 **/.conda/
6
7 -# Ignore docker/run/agent-zero directory
8 -docker/run/agent-zero/
9 -
7 #Ignore cursor rules
8 .cursor/
9
10 # ignore test files in root dir
11 /*.test.py
12
16 -# Ignore git internal files (for bundler)
17 -.git/
18 -
13 # Ignore all contents of the virtual environment directory
14 .venv/
15
22 -# Handle bundle directory
23 -bundle/*/
24 -!bundle/mac_pkg_scripts
25 -
26 -# Handle work_dir directory
27 -work_dir/*
28 -
29 -# Handle specific docker directories
30 -docker/run/agent-zero/**
31 -
16 # Handle memory directory
17 memory/**
18 !memory/**/
DockerfileLocal new
+36
@@ -0,0 +1,36 @@
1 +# Use the pre-built base image for A0
2 +# FROM agent-zero-base:local
3 +FROM agent0ai/agent-zero-base:latest
4 +
5 +# Set BRANCH to "local" if not provided
6 +ARG BRANCH=local
7 +ENV BRANCH=$BRANCH
8 +
9 +# Copy filesystem files to root
10 +COPY ./docker/run/fs/ /
11 +# Copy current development files to git, they will only be used in "local" branch
12 +COPY ./ /git/agent-zero
13 +
14 +# pre installation steps
15 +RUN bash /ins/pre_install.sh $BRANCH
16 +
17 +# install A0
18 +RUN bash /ins/install_A0.sh $BRANCH
19 +
20 +# install additional software
21 +RUN bash /ins/install_additional.sh $BRANCH
22 +
23 +# cleanup repo and install A0 without caching, this speeds up builds
24 +ARG CACHE_DATE=none
25 +RUN echo "cache buster $CACHE_DATE" && bash /ins/install_A02.sh $BRANCH
26 +
27 +# post installation steps
28 +RUN bash /ins/post_install.sh $BRANCH
29 +
30 +# Expose ports
31 +EXPOSE 22 80 9000-9009
32 +
33 +RUN chmod +x /exe/initialize.sh /exe/run_A0.sh /exe/run_searxng.sh /exe/run_tunnel_api.sh
34 +
35 +# initialize runtime and switch to supervisord
36 +CMD ["/exe/initialize.sh", "$BRANCH"]
docker/run/Dockerfile
+1 -1
@@ -7,7 +7,7 @@ ARG BRANCH
7 RUN if [ -z "$BRANCH" ]; then echo "ERROR: BRANCH is not set!" >&2; exit 1; fi
8 ENV BRANCH=$BRANCH
9
10 -# Copy contents of the project to /a0
10 +# Copy filesystem files to root
11 COPY ./fs/ /
12
13 # pre installation steps
docker/run/build.txt
+16 -7
@@ -1,23 +1,32 @@
1 -# local image with smart cache
2 -docker build -t agent-zero:local --build-arg BRANCH=development --build-arg CACHE_DATE=$(date +%Y-%m-%d:%H:%M:%S) .
1
4 -# local image without cache
5 -docker build -t agent-zero:local --build-arg BRANCH=development --no-cache .
2 +# LOCAL BUILDS
3 +# Run these commands from the project root folder
4 +
5 +# local development image based on local files with smart cache
6 +docker build -f DockerfileLocal -t agent-zero-local --build-arg CACHE_DATE=$(date +%Y-%m-%d:%H:%M:%S) .
7 +
8 +# local development image based on local files without cache
9 +docker build -f DockerfileLocal -t agent-zero-local --no-cache .
10 +
11 +# local image based on testing branch instead of local files
12 +docker build -f ./docker/run/Dockerfile -t agent-zero-testing --build-arg BRANCH=testing .
13
14
15
16 # dockerhub push:
17 +# Run these commands from the project root folder
18 +
19
20 docker login
21
22 # development:
14 -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) .
23 +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
24
25 # testing:
17 -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) .
26 +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
27
28 # main
20 -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) .
29 +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
30
31
32 # plain output
docker/run/fs/ins/install_A0.sh
+14 -4
@@ -11,10 +11,20 @@ if [ -z "$1" ]; then
11 fi
12 BRANCH="$1"
13
14 -git clone -b "$BRANCH" "https://github.com/agent0ai/agent-zero" "/git/agent-zero" || {
15 - echo "CRITICAL ERROR: Failed to clone repository. Branch: $BRANCH"
16 - exit 1
17 -}
14 +if [ "$BRANCH" = "local" ]; then
15 + # For local branch, use the files
16 + echo "Using local dev files in /git/agent-zero"
17 + # List all files recursively in the target directory
18 + # echo "All files in /git/agent-zero (recursive):"
19 + # find "/git/agent-zero" -type f | sort
20 +else
21 + # For other branches, clone from GitHub
22 + echo "Cloning repository from branch $BRANCH..."
23 + git clone -b "$BRANCH" "https://github.com/agent0ai/agent-zero" "/git/agent-zero" || {
24 + echo "CRITICAL ERROR: Failed to clone repository. Branch: $BRANCH"
25 + exit 1
26 + }
27 +fi
28
29 . "/ins/setup_venv.sh" "$@"
30
docker/run/fs/ins/install_A02.sh
+4 -2
@@ -3,8 +3,10 @@ set -e
3
4 # cachebuster script, this helps speed up docker builds
5
6 -# remove repo
7 -rm -rf /git/agent-zero
6 +# remove repo (if not local branch)
7 +if [ "$1" != "local" ]; then
8 + rm -rf /git/agent-zero
9 +fi
10
11 # run the original install script again
12 bash /ins/install_A0.sh "$@"
example.env deleted
-28
@@ -1,28 +0,0 @@
1 -API_KEY_OPENAI=
2 -API_KEY_ANTHROPIC=
3 -API_KEY_GROQ=
4 -API_KEY_PERPLEXITY=
5 -API_KEY_GOOGLE=
6 -API_KEY_MISTRAL=
7 -API_KEY_OPENROUTER=
8 -API_KEY_SAMBANOVA=
9 -
10 -API_KEY_OPENAI_AZURE=
11 -OPENAI_AZURE_ENDPOINT=
12 -OPENAI_API_VERSION=
13 -
14 -HF_TOKEN=
15 -
16 -
17 -WEB_UI_PORT=50001
18 -USE_CLOUDFLARE=false
19 -
20 -
21 -OLLAMA_BASE_URL="http://127.0.0.1:11434"
22 -LM_STUDIO_BASE_URL="http://127.0.0.1:1234/v1"
23 -OPEN_ROUTER_BASE_URL="https://openrouter.ai/api/v1"
24 -SAMBANOVA_BASE_URL="https://fast-api.snova.ai/v1"
25 -
26 -
27 -TOKENIZERS_PARALLELISM=true
28 -PYDEVD_DISABLE_FILE_VALIDATION=1