Skip to content

Agent Zero AI framework

dockerfile, compose, smart cache

frdel0ce8344f0b7b
diff --git a/docker/run/Dockerfile b/docker/run/Dockerfile
index 7c02b0c55..0ea5db3d0 100644
--- a/docker/run/Dockerfile
+++ b/docker/run/Dockerfile
@@ -20,6 +20,7 @@ RUN apt-get update && apt-get install -y \
# Cleanup package list
RUN rm -rf /var/lib/apt/lists/*
+RUN apt-get clean
# Set up SSH
RUN mkdir /var/run/sshd && \
@@ -29,12 +30,16 @@ RUN mkdir /var/run/sshd && \
# Copy contents of the project to /a0
COPY ./fs/ /
-# install a0
-RUN bash /ins/install_A0.sh
-
# install additional software
RUN bash /ins/install_searxng.sh
+# install a0 with caching
+RUN bash /ins/install_A0.sh
+
+# cleanup repo and install a0 without caching, this speeds up builds
+ARG CACHE_DATE=unknown
+RUN echo "cache buster $CACHE_DATE" && bash /ins/install_A02.sh
+
# Expose ports
# EXPOSE 22
EXPOSE 80
diff --git a/docker/run/build.txt b/docker/run/build.txt
index d5d52dd2d..94c8817b2 100644
--- a/docker/run/build.txt
+++ b/docker/run/build.txt
@@ -1,6 +1,7 @@
-# local image
-docker build -t agent-zero-run:latest .
+# local image with smart cache
+docker build -t agent-zero-run:local --build-arg CACHE_DATE=$(date +%Y-%m-%d:%H:%M:%S) .
-# dockerhub
+# dockerhub push with and without caching
docker login
-docker buildx build --platform linux/amd64,linux/arm64 -t frdel/agent-zero-run:testing --push .
\ No newline at end of file
+docker buildx build --platform linux/amd64,linux/arm64 -t frdel/agent-zero-run:testing --push --build-arg CACHE_DATE=$(date +%Y-%m-%d:%H:%M:%S) .
+docker buildx build --platform linux/amd64,linux/arm64 -t frdel/agent-zero-run:testing --push --no-cache .
\ No newline at end of file
diff --git a/docker/run/docker-compose.yml b/docker/run/docker-compose.yml
new file mode 100644
index 000000000..1adb30017
--- /dev/null
+++ b/docker/run/docker-compose.yml
@@ -0,0 +1,10 @@
+version: '3'
+
+services:
+ agent-zero:
+ container_name: agent-zero
+ image: frdel/agent-zero-run:testing
+ volumes:
+ - ./agent-zero:/a0
+ ports:
+ - "8080:80"
\ No newline at end of file
diff --git a/docker/run/fs/ins/install_A02.sh b/docker/run/fs/ins/install_A02.sh
new file mode 100644
index 000000000..6791083a9
--- /dev/null
+++ b/docker/run/fs/ins/install_A02.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+BRANCH="development"
+
+git clone -b "$BRANCH" "https://github.com/frdel/agent-zero" "/a0"
+
+# Create and activate Python virtual environment
+python3 -m venv /opt/venv
+source /opt/venv/bin/activate
+
+# Ensure the virtual environment and pip setup
+pip install --upgrade pip ipython requests
+
+# Install some packages in specific variants
+pip install torch --index-url https://download.pytorch.org/whl/cpu
+
+# Install remaining A0 python packages
+pip install -r /a0/requirements.txt
+
+# Preload A0
+python /a0/preload.py