The Merge - initial changes
frdel committed
May 27, 2025 at 18:48 UTC
d0ae5e54f72868a94377725e0adfd53c381ed8ca
17 files changed
+137
-119
docker/base/Dockerfile
new
+31
@@ -0,0 +1,31 @@
1
+# Use the latest slim version of Kali Linux
2
+FROM kalilinux/kali-rolling
3
+
4
+
5
+# Set locale to en_US.UTF-8 and timezone to UTC
6
+RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales tzdata
7
+RUN sed -i -e 's/# \(en_US\.UTF-8 .*\)/\1/' /etc/locale.gen && \
8
+ dpkg-reconfigure --frontend=noninteractive locales && \
9
+ update-locale LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
10
+RUN ln -sf /usr/share/zoneinfo/UTC /etc/localtime
11
+RUN echo "UTC" > /etc/timezone
12
+RUN dpkg-reconfigure -f noninteractive tzdata
13
+ENV LANG=en_US.UTF-8
14
+ENV LANGUAGE=en_US:en
15
+ENV LC_ALL=en_US.UTF-8
16
+ENV TZ=UTC
17
+
18
+# Copy contents of the project to /
19
+COPY ./fs/ /
20
+
21
+# install python
22
+RUN bash /ins/install_python.sh
23
+
24
+# install packages software
25
+RUN bash /ins/install_base_packages.sh
26
+
27
+# configure ssh
28
+RUN bash /ins/configure_ssh.sh
29
+
30
+# Keep container running infinitely
31
+CMD ["tail", "-f", "/dev/null"]
docker/base/build.txt
new
+15
@@ -0,0 +1,15 @@
1
+# local image with smart cache
2
+docker build -t agent-zero-base:local --build-arg CACHE_DATE=$(date +%Y-%m-%d:%H:%M:%S) .
3
+
4
+# local image without cache
5
+docker build -t agent-zero-base:local --no-cache .
6
+
7
+# dockerhub push:
8
+
9
+docker login
10
+
11
+# with cache
12
+docker buildx build -t frdel/agent-zero-base:latest --platform linux/amd64,linux/arm64 --push --build-arg CACHE_DATE=$(date +%Y-%m-%d:%H:%M:%S) .
13
+
14
+# without cache
15
+docker buildx build -t frdel/agent-zero-base:latest --platform linux/amd64,linux/arm64 --push --build-arg CACHE_DATE=$(date +%Y-%m-%d:%H:%M:%S) --no-cache .
docker/base/fs/ins/configure_ssh.sh
new
+5
@@ -0,0 +1,5 @@
1
+#!/bin/bash
2
+
3
+# Set up SSH
4
+mkdir -p /var/run/sshd && \
5
+ sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
\ No newline at end of file
docker/base/fs/ins/configure_venv.sh
new
+9
@@ -0,0 +1,9 @@
1
+#!/bin/bash
2
+
3
+if [ ! -d /opt/venv ]; then
4
+ # Create and activate Python virtual environment
5
+ python3 -m venv /opt/venv
6
+ source /opt/venv/bin/activate
7
+else
8
+ source /opt/venv/bin/activate
9
+fi
\ No newline at end of file
docker/base/fs/ins/install_base_packages.sh
new
+19
@@ -0,0 +1,19 @@
1
+#!/bin/bash
2
+set -e
3
+
4
+echo "=====BASE PACKAGES====="
5
+
6
+# Hold python3 packages to prevent overrides
7
+apt-mark hold python3
8
+
9
+# Install with --no-install-recommends to minimize unwanted dependencies
10
+apt-get install -y --no-install-recommends \
11
+ nodejs openssh-server sudo curl wget git ffmpeg supervisor cron
12
+
13
+
14
+echo "=====AFTER UPDATE====="
15
+
16
+
17
+echo "=====PYTHON VERSION: $(python3 --version) ====="
18
+echo "=====PYTHON OTHERS: $(ls /usr/bin/python*) ====="
19
+sleep 10
\ No newline at end of file
docker/base/fs/ins/install_python.sh
new
+44
@@ -0,0 +1,44 @@
1
+#!/bin/bash
2
+set -e
3
+
4
+# echo "=====PYTHON 3.12 & SID REPO====="
5
+
6
+# apt clean
7
+
8
+# # ★ 1. Add sid repo & pin it for python 3.12
9
+# echo "deb http://deb.debian.org/debian sid main" > /etc/apt/sources.list.d/debian-sid.list
10
+# cat >/etc/apt/preferences.d/python312 <<'EOF'
11
+# Package: *
12
+# Pin: release a=sid
13
+# Pin-Priority: 100
14
+
15
+# Package: python3.12*
16
+# Pin: release a=sid
17
+# Pin-Priority: 990
18
+
19
+# # Prevent Python 3.13 from being installed
20
+# Package: python3.13*
21
+# Pin: release *
22
+# Pin-Priority: -1
23
+# EOF
24
+
25
+# apt-get update && apt-get -y upgrade
26
+
27
+# apt-get install -y --no-install-recommends \
28
+# python3.12 python3.12-venv python3.12-dev
29
+
30
+# # ★ 3. Switch the interpreter
31
+# # update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.13 0
32
+# update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1
33
+# update-alternatives --set python3 /usr/bin/python3.12
34
+
35
+# echo "=====PYTHON VERSION: $(python3 --version) ====="
36
+# echo "=====PYTHON OTHERS: $(ls /usr/bin/python*) ====="
37
+# sleep 10
38
+
39
+apt-get update && apt-get -y upgrade
40
+
41
+apt-get install -y --no-install-recommends \
42
+ python3 python3-venv python3-dev
43
+
44
+. /ins/configure_venv.sh
\ No newline at end of file
docker/run/Dockerfile
+3
-15
@@ -1,24 +1,12 @@
1
# Use the latest slim version of Debian
2
-FROM debian:bookworm-slim
2
+FROM agent-zero-base:local
3
+# FROM frdel/agent-zero-base:latest
4
5
# Check if the argument is provided, else throw an error
6
ARG BRANCH
7
RUN if [ -z "$BRANCH" ]; then echo "ERROR: BRANCH is not set!" >&2; exit 1; fi
8
ENV BRANCH=$BRANCH
9
9
-# Set locale to en_US.UTF-8 and timezone to UTC
10
-RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales tzdata
11
-RUN sed -i -e 's/# \(en_US\.UTF-8 .*\)/\1/' /etc/locale.gen && \
12
- dpkg-reconfigure --frontend=noninteractive locales && \
13
- update-locale LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
14
-RUN ln -sf /usr/share/zoneinfo/UTC /etc/localtime
15
-RUN echo "UTC" > /etc/timezone
16
-RUN dpkg-reconfigure -f noninteractive tzdata
17
-ENV LANG=en_US.UTF-8
18
-ENV LANGUAGE=en_US:en
19
-ENV LC_ALL=en_US.UTF-8
20
-ENV TZ=UTC
21
-
10
# Copy contents of the project to /a0
11
COPY ./fs/ /
12
@@ -39,7 +27,7 @@ RUN echo "cache buster $CACHE_DATE" && bash /ins/install_A02.sh $BRANCH
27
RUN bash /ins/post_install.sh $BRANCH
28
29
# Expose ports
42
-EXPOSE 22 80
30
+EXPOSE 22 80 3000-9999
31
32
RUN chmod +x /exe/initialize.sh /exe/run_A0.sh /exe/run_searxng.sh /exe/run_tunnel_api.sh
33
docker/run/DockerfileKali
deleted
-48
@@ -1,48 +0,0 @@
1
-# Use the latest slim version of Kali Linux
2
-FROM kalilinux/kali-rolling
3
-
4
-# Check if the argument is provided, else throw an error
5
-ARG BRANCH
6
-RUN if [ -z "$BRANCH" ]; then echo "ERROR: BRANCH is not set!" >&2; exit 1; fi
7
-ENV BRANCH=$BRANCH
8
-
9
-# Set locale to en_US.UTF-8 and timezone to UTC
10
-RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales tzdata
11
-RUN sed -i -e 's/# \(en_US\.UTF-8 .*\)/\1/' /etc/locale.gen && \
12
- dpkg-reconfigure --frontend=noninteractive locales && \
13
- update-locale LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
14
-RUN ln -sf /usr/share/zoneinfo/UTC /etc/localtime
15
-RUN echo "UTC" > /etc/timezone
16
-RUN dpkg-reconfigure -f noninteractive tzdata
17
-ENV LANG=en_US.UTF-8
18
-ENV LANGUAGE=en_US:en
19
-ENV LC_ALL=en_US.UTF-8
20
-ENV TZ=UTC
21
-
22
-# Copy contents of the project to /a0
23
-COPY ./fs/ /
24
-
25
-# pre installation steps
26
-RUN bash /ins/pre_install.sh $BRANCH
27
-RUN bash /ins/pre_install_kali.sh $BRANCH
28
-
29
-# install A0
30
-RUN bash /ins/install_A0.sh $BRANCH
31
-
32
-# install additional software
33
-RUN bash /ins/install_additional.sh $BRANCH
34
-
35
-# cleanup repo and install A0 without caching, this speeds up builds
36
-ARG CACHE_DATE=none
37
-RUN echo "cache buster $CACHE_DATE" && bash /ins/install_A02.sh $BRANCH
38
-
39
-# post installation steps
40
-RUN bash /ins/post_install.sh $BRANCH
41
-
42
-# Expose ports
43
-EXPOSE 22 80
44
-
45
-RUN chmod +x /exe/initialize.sh /exe/run_A0.sh /exe/run_searxng.sh
46
-
47
-# initialize runtime and switch to supervisord
48
-CMD ["/exe/initialize.sh", "$BRANCH"]
docker/run/fs/etc/searxng/settings.yml
+1
@@ -16,6 +16,7 @@ search:
16
server:
17
# Is overwritten by ${SEARXNG_SECRET}
18
secret_key: "dummy"
19
+ port: 55510
20
limiter: false
21
image_proxy: false
22
# public URL of the instance, to ensure correct inbound links. Is overwritten
docker/run/fs/exe/run_tunnel_api.sh
+1
-1
@@ -14,7 +14,7 @@ done
14
exec python /a0/run_tunnel.py \
15
--dockerized=true \
16
--port=80 \
17
- --tunnel_api_port=5070 \
17
+ --tunnel_api_port=55520 \
18
--host="0.0.0.0" \
19
--code_exec_docker_enabled=false \
20
--code_exec_ssh_enabled=true \
docker/run/fs/ins/install_playwright.sh
+5
-5
@@ -8,11 +8,11 @@ pip install playwright
8
9
# install chromium with dependencies
10
# for kali-based
11
-if [ "$@" = "hacking" ]; then
11
+# if [ "$@" = "hacking" ]; then
12
apt-get install -y fonts-unifont libnss3 libnspr4
13
playwright install chromium-headless-shell
14
-else
15
- # for debian based
16
- playwright install --with-deps chromium-headless-shell
17
-fi
14
+# else
15
+# # for debian based
16
+# playwright install --with-deps chromium-headless-shell
17
+# fi
18
docker/run/fs/ins/pre_install.sh
-40
@@ -3,45 +3,5 @@
3
# fix permissions for cron files
4
chmod 0644 /etc/cron.d/*
5
6
-echo "=====BEFORE UPDATE====="
7
-
8
-# Update and install necessary packages
9
-apt clean
10
-apt-get update && apt-get upgrade -y && apt-get install -y \
11
- python3 \
12
- python3-venv \
13
- python3-pip \
14
- nodejs \
15
- openssh-server \
16
- sudo \
17
- curl \
18
- wget \
19
- git \
20
- ffmpeg \
21
- supervisor \
22
- cron
23
-
24
-echo "=====MID UPDATE====="
25
-
26
-# for some reason npm crashes builds on amd64 in this version and has to be installed separately
27
-# A0 can install it when needed
28
-# apt-get install -y \
29
-# npm
30
-
31
-echo "=====AFTER UPDATE====="
32
-
33
-# # Configure system alternatives so that /usr/bin/python3 points to Python 3.12
34
-# sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1
35
-# sudo update-alternatives --set python3 /usr/bin/python3.12
36
-
37
-# Update pip3 symlink: if pip3.12 exists, point pip3 to it;
38
-# otherwise, install pip using Python 3.12's ensurepip.
39
-# if [ -f /usr/bin/pip3.12 ]; then
40
-# sudo ln -sf /usr/bin/pip3.12 /usr/bin/pip3
41
-# else
42
-# python3 -m ensurepip --upgrade
43
-# python3 -m pip install --upgrade pip
44
-# fi
45
-
6
# Prepare SSH daemon
7
bash /ins/setup_ssh.sh "$@"
docker/run/fs/ins/pre_install_kali.sh
deleted
-6
@@ -1,6 +0,0 @@
1
-#!/bin/bash
2
-
3
-# ubuntu based dependencies for playwright
4
-# moved to install_playwright.sh
5
-# apt-get update && apt-get install -y fonts-unifont fonts-ubuntu
6
-
python/api/tunnel_proxy.py
+1
-1
@@ -11,7 +11,7 @@ class TunnelProxy(ApiHandler):
11
tunnel_api_port = (
12
runtime.get_arg("tunnel_api_port")
13
or int(dotenv.get_dotenv_value("TUNNEL_API_PORT", 0))
14
- or 5070
14
+ or 55520
15
)
16
17
# first verify the service is running:
python/helpers/runtime.py
+1
-1
@@ -138,6 +138,6 @@ def get_tunnel_api_port():
138
tunnel_api_port = (
139
get_arg("tunnel_api_port")
140
or int(dotenv.get_dotenv_value("TUNNEL_API_PORT", 0))
141
- or 5070
141
+ or 55520
142
)
143
return tunnel_api_port
\ No newline at end of file
python/helpers/searxng.py
+1
-1
@@ -1,7 +1,7 @@
1
import aiohttp
2
from python.helpers import runtime
3
4
-URL = "http://localhost:8888/search"
4
+URL = "http://localhost:55510/search"
5
6
async def search(query:str):
7
return await runtime.call_development_function(_search, query=query)
requirements.txt
+1
-1
@@ -24,7 +24,7 @@ newspaper3k==0.2.8
24
paramiko==3.5.0
25
playwright==1.52.0
26
pypdf==4.3.1
27
-python-dotenv==1.0.1
27
+python-dotenv==1.1.0
28
pytz==2024.2
29
sentence-transformers==3.0.1
30
tiktoken==0.8.0