dockerfile, compose, smart cache
frdel committed
Nov 19, 2024 at 00:23 UTC
0ce8344f0b7bc7956539960199d7371bd902e229
4 files changed
+44
-7
docker/run/Dockerfile
+8
-3
@@ -20,6 +20,7 @@ RUN apt-get update && apt-get install -y \
20
21
# Cleanup package list
22
RUN rm -rf /var/lib/apt/lists/*
23
+RUN apt-get clean
24
25
# Set up SSH
26
RUN mkdir /var/run/sshd && \
@@ -29,12 +30,16 @@ RUN mkdir /var/run/sshd && \
30
# Copy contents of the project to /a0
31
COPY ./fs/ /
32
32
-# install a0
33
-RUN bash /ins/install_A0.sh
34
-
33
# install additional software
34
RUN bash /ins/install_searxng.sh
35
36
+# install a0 with caching
37
+RUN bash /ins/install_A0.sh
38
+
39
+# cleanup repo and install a0 without caching, this speeds up builds
40
+ARG CACHE_DATE=unknown
41
+RUN echo "cache buster $CACHE_DATE" && bash /ins/install_A02.sh
42
+
43
# Expose ports
44
# EXPOSE 22
45
EXPOSE 80
docker/run/build.txt
+5
-4
@@ -1,6 +1,7 @@
1
-# local image
2
-docker build -t agent-zero-run:latest .
1
+# local image with smart cache
2
+docker build -t agent-zero-run:local --build-arg CACHE_DATE=$(date +%Y-%m-%d:%H:%M:%S) .
3
4
-# dockerhub
4
+# dockerhub push with and without caching
5
docker login
6
-docker buildx build --platform linux/amd64,linux/arm64 -t frdel/agent-zero-run:testing --push .
\ No newline at end of file
6
+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) .
7
+docker buildx build --platform linux/amd64,linux/arm64 -t frdel/agent-zero-run:testing --push --no-cache .
\ No newline at end of file
docker/run/docker-compose.yml
new
+10
@@ -0,0 +1,10 @@
1
+version: '3'
2
+
3
+services:
4
+ agent-zero:
5
+ container_name: agent-zero
6
+ image: frdel/agent-zero-run:testing
7
+ volumes:
8
+ - ./agent-zero:/a0
9
+ ports:
10
+ - "8080:80"
\ No newline at end of file
docker/run/fs/ins/install_A02.sh
new
+21
@@ -0,0 +1,21 @@
1
+#!/bin/bash
2
+
3
+BRANCH="development"
4
+
5
+git clone -b "$BRANCH" "https://github.com/frdel/agent-zero" "/a0"
6
+
7
+# Create and activate Python virtual environment
8
+python3 -m venv /opt/venv
9
+source /opt/venv/bin/activate
10
+
11
+# Ensure the virtual environment and pip setup
12
+pip install --upgrade pip ipython requests
13
+
14
+# Install some packages in specific variants
15
+pip install torch --index-url https://download.pytorch.org/whl/cpu
16
+
17
+# Install remaining A0 python packages
18
+pip install -r /a0/requirements.txt
19
+
20
+# Preload A0
21
+python /a0/preload.py