x86 build fix + build cleanup

frdel committed Jun 17, 2025 at 20:49 UTC 8edcb957b930a02b15b5befae6453ab633237e3c
18 files changed +36 -208
docker/base/Dockerfile
+3
@@ -33,5 +33,8 @@ RUN bash /ins/install_searxng.sh
33 # configure ssh
34 RUN bash /ins/configure_ssh.sh
35
36 +# after install
37 +RUN bash /ins/after_install.sh
38 +
39 # Keep container running infinitely
40 CMD ["tail", "-f", "/dev/null"]
docker/base/fs/ins/after_install.sh new
+5
@@ -0,0 +1,5 @@
1 +#!/bin/bash
2 +set -e
3 +
4 +# clean up apt cache
5 +sudo apt-get clean
docker/base/fs/ins/configure_ssh.sh
+1
@@ -1,4 +1,5 @@
1 #!/bin/bash
2 +set -e
3
4 # Set up SSH
5 mkdir -p /var/run/sshd && \
docker/base/fs/ins/install_python.sh
+9 -3
@@ -44,13 +44,19 @@ python3.12 -m venv /opt/venv
44 source /opt/venv/bin/activate
45
46 # upgrade pip and install static packages
47 -pip install --upgrade pip ipython requests
47 +pip install --no-cache-dir --upgrade pip ipython requests
48 # Install some packages in specific variants
49 -pip install torch --index-url https://download.pytorch.org/whl/cpu
50 -
49 +pip install --no-cache-dir \
50 + torch==2.4.0+cpu \
51 + torchvision==0.19.0+cpu \
52 + torchaudio==2.4.0+cpu \
53 + --index-url https://download.pytorch.org/whl/cpu
54
55 echo "====================PYTHON UV ===================="
56
57 curl -Ls https://astral.sh/uv/install.sh | UV_INSTALL_DIR=/usr/local/bin sh
58
59 +# clean up pip cache
60 +pip cache purge
61 +
62 echo "====================PYTHON END===================="
docker/base/fs/ins/install_searxng.sh
+1
@@ -1,4 +1,5 @@
1 #!/bin/bash
2 +set -e
3
4 echo "====================SEARXNG1 START===================="
5
docker/base/fs/ins/install_searxng2.sh
+3 -5
@@ -1,4 +1,5 @@
1 #!/bin/bash
2 +set -e
3
4 echo "====================SEARXNG2 START===================="
5
@@ -22,14 +23,11 @@ source "/usr/local/searxng/searx-pyenv/bin/activate"
23 echo "====================SEARXNG2 INST===================="
24
25 # update pip's boilerplate
25 -pip install -U pip
26 -pip install -U setuptools
27 -pip install -U wheel
28 -pip install -U pyyaml
26 +pip install --no-cache-dir -U pip setuptools wheel pyyaml
27
28 # jump to SearXNG's working tree and install SearXNG into virtualenv
29 cd "/usr/local/searxng/searxng-src"
32 -pip install --use-pep517 --no-build-isolation -e .
30 +pip install --no-cache-dir --use-pep517 --no-build-isolation -e .
31
32 # cleanup cache
33 pip cache purge
docker/run/Dockerfile.cuda deleted
-159
@@ -1,159 +0,0 @@
1 -# Use the NVIDIA CUDA base image with Ubuntu
2 -FROM nvidia/cuda:12.8.1-base-ubuntu22.04
3 -
4 -# Set non-interactive installation and timezone
5 -ENV DEBIAN_FRONTEND=noninteractive
6 -ENV TZ=UTC
7 -
8 -# Check if the argument is provided, else throw an error
9 -ARG BRANCH
10 -RUN if [ -z "$BRANCH" ]; then echo "ERROR: BRANCH is not set!" >&2; exit 1; fi
11 -ENV BRANCH=$BRANCH
12 -
13 -# Set locale to en_US.UTF-8 and timezone to UTC (matching main Dockerfile)
14 -RUN apt-get update && apt-get install -y locales tzdata
15 -RUN sed -i -e 's/# \(en_US\.UTF-8 .*\)/\1/' /etc/locale.gen && \
16 - dpkg-reconfigure --frontend=noninteractive locales && \
17 - update-locale LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
18 -RUN ln -sf /usr/share/zoneinfo/UTC /etc/localtime
19 -RUN echo "UTC" > /etc/timezone
20 -RUN dpkg-reconfigure -f noninteractive tzdata
21 -ENV LANG=en_US.UTF-8
22 -ENV LANGUAGE=en_US:en
23 -ENV LC_ALL=en_US.UTF-8
24 -ENV TZ=UTC
25 -
26 -# Copy contents of the project to root directory
27 -COPY ./fs/ /
28 -
29 -# Fix permissions for cron files from pre_install.sh
30 -RUN chmod 0644 /etc/cron.d/*
31 -
32 -# Install essential packages (from pre_install.sh but avoiding supervisor from apt)
33 -# Node.js and npm will be installed separately using NodeSource for a specific version
34 -RUN apt-get update && apt-get upgrade -y && apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install -y \
35 - python3 \
36 - python3-venv \
37 - python3-pip \
38 - openssh-server \
39 - sudo \
40 - curl \
41 - wget \
42 - git \
43 - ffmpeg \
44 - cron
45 -
46 -# Install Node.js 20.x (LTS) and a compatible npm
47 -RUN apt-get update && apt-get install -y ca-certificates curl gnupg
48 -RUN mkdir -p /etc/apt/keyrings
49 -RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
50 -RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
51 -RUN apt-get update && apt-get install -y nodejs || { echo "CRITICAL ERROR: Failed to install Node.js from NodeSource." ; exit 1; }
52 -
53 -# Prepare SSH daemon (from pre_install.sh)
54 -RUN bash /ins/setup_ssh.sh $BRANCH
55 -
56 -# Configure Python 3.12 (specific to Ubuntu-based CUDA image)
57 -RUN apt-get update && apt-get install -y \
58 - software-properties-common && \
59 - add-apt-repository -y ppa:deadsnakes/ppa && \
60 - apt-get update && \
61 - apt-get install -y python3.12 python3.12-venv python3.12-dev && \
62 - update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 && \
63 - update-alternatives --set python3 /usr/bin/python3.12
64 -
65 -# Bootstrap pip for Python 3.12 and install supervisor
66 -RUN python3 -m ensurepip --upgrade && \
67 - python3 -m pip install --upgrade pip setuptools wheel && \
68 - python3 -m pip install supervisor
69 -
70 -# Create supervisor directories
71 -RUN mkdir -p /var/log/supervisor /etc/supervisor/conf.d
72 -
73 -# Create root dotfiles with appropriate permissions
74 -RUN touch /root/.bashrc /root/.profile && \
75 - chmod 644 /root/.bashrc /root/.profile
76 -
77 -# Create a symlink for supervisord to the expected location
78 -RUN ln -sf $(which supervisord) /usr/bin/supervisord
79 -
80 -# Install additional software
81 -RUN bash /ins/install_additional.sh $BRANCH
82 -
83 -# Install core CUDA dependencies (minimized to essentials)
84 -RUN apt-get update && apt-get install -y --no-install-recommends \
85 - cuda-cudart-dev-12-8 \
86 - libcublas-dev-12-8 \
87 - libcudnn8 \
88 - && apt-get clean \
89 - && rm -rf /var/lib/apt/lists/*
90 -
91 -# Set CUDA environment variables
92 -ENV PATH=/usr/local/cuda/bin:${PATH}
93 -ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH}
94 -ENV CUDA_HOME=/usr/local/cuda
95 -ENV CUDA_VERSION=12.8.1
96 -
97 -# Install A0
98 -RUN bash /ins/install_A0.sh $BRANCH
99 -
100 -# Create and set up the shared instruments virtual environment
101 -ENV INSTRUMENTS_VENV_PATH=/opt/instruments_venv
102 -RUN python3 -m venv $INSTRUMENTS_VENV_PATH
103 -
104 -# Switch to bash for the next RUN step (required for set -o pipefail)
105 -SHELL ["/bin/bash", "-c"]
106 -
107 -# Install all heavy dependencies into the instruments venv, with explicit checks
108 -RUN set -euxo pipefail; \
109 - . $INSTRUMENTS_VENV_PATH/bin/activate; \
110 - echo "=== Upgrading pip, setuptools, wheel ==="; \
111 - pip install --upgrade pip setuptools wheel; \
112 - echo "=== Installing PyTorch with CUDA ==="; \
113 - pip install --no-cache-dir torch==2.6.0+cu124 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124; \
114 - echo "=== Installing other heavy dependencies ==="; \
115 - pip install --no-cache-dir \
116 - huggingface-hub==0.20.3 \
117 - safetensors==0.4.1 \
118 - accelerate==0.21.0 \
119 - diffusers==0.25.0 \
120 - transformers==4.38.2 \
121 - scipy==1.15.2 \
122 - xformers==0.0.29.post3; \
123 - echo "=== Checking all critical imports ==="; \
124 - python -c "import torch; print(f'PyTorch {torch.__version__} imported successfully. CUDA: {getattr(torch, 'cuda', None) and torch.cuda.is_available()}')" || (echo 'PyTorch import failed!' && exit 1); \
125 - python -c "import torchvision; print(f'Torchvision {torchvision.__version__} imported successfully.')" || (echo 'Torchvision import failed!' && exit 1); \
126 - python -c "import torchaudio; print(f'Torchaudio {torchaudio.__version__} imported successfully.')" || (echo 'Torchaudio import failed!' && exit 1); \
127 - python -c "import diffusers; print(f'Diffusers {diffusers.__version__} imported successfully.')" || (echo 'Diffusers import failed!' && exit 1); \
128 - python -c "import transformers; print(f'Transformers {transformers.__version__} imported successfully.')" || (echo 'Transformers import failed!' && exit 1); \
129 - python -c "import xformers; print(f'Xformers {xformers.__version__} imported successfully.')" || (echo 'Xformers import failed!' && exit 1); \
130 - python -c "import accelerate; print(f'Accelerate {accelerate.__version__} imported successfully.')" || (echo 'Accelerate import failed!' && exit 1); \
131 - python -c "import safetensors; print(f'Safetensors {safetensors.__version__} imported successfully.')" || (echo 'Safetensors import failed!' && exit 1); \
132 - python -c "import scipy; print(f'Scipy {scipy.__version__} imported successfully.')" || (echo 'Scipy import failed!' && exit 1); \
133 - python -c "import huggingface_hub; print(f'Huggingface_hub {huggingface_hub.__version__} imported successfully.')" || (echo 'Huggingface_hub import failed!' && exit 1); \
134 - echo "=== All critical imports succeeded ==="
135 -
136 -# Optionally revert to sh for subsequent steps if needed
137 -SHELL ["/bin/sh", "-c"]
138 -
139 -# The existing global PyTorch install for /opt/venv (A0's main venv) is below.
140 -# It might be used by other core A0 components, so we keep it.
141 -# Our instruments will use the dedicated $INSTRUMENTS_VENV_PATH.
142 -RUN . /opt/venv/bin/activate && \
143 - pip uninstall -y torch torchvision && \
144 - pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cu124
145 -
146 -# Cleanup repo and install A0 without caching, this speeds up builds
147 -ARG CACHE_DATE=none
148 -RUN echo "cache buster $CACHE_DATE" && bash /ins/install_A02.sh $BRANCH
149 -
150 -# Post installation steps
151 -RUN bash /ins/post_install.sh $BRANCH
152 -
153 -# Expose ports
154 -EXPOSE 22 80
155 -
156 -RUN chmod +x /exe/initialize.sh /exe/run_A0.sh /exe/run_searxng.sh
157 -
158 -# Initialize runtime
159 -CMD ["/exe/initialize.sh", "$BRANCH"]
docker/run/docker-compose.cuda.yml deleted
-20
@@ -1,20 +0,0 @@
1 -services:
2 - agent-zero-cuda:
3 - container_name: agent-zero-cuda
4 - image: frdel/agent-zero-run-cuda:testing
5 - volumes:
6 - - ./agent-zero:/a0
7 - - ./agent-zero/work_dir:/root
8 - ports:
9 - - "50080:80"
10 - environment:
11 - - NVIDIA_VISIBLE_DEVICES=all
12 - - NVIDIA_DRIVER_CAPABILITIES=compute,utility
13 - - PYTHONUNBUFFERED=1
14 - deploy:
15 - resources:
16 - reservations:
17 - devices:
18 - - driver: nvidia
19 - count: all
20 - capabilities: [gpu]
\ No newline at end of file
docker/run/fs/etc/searxng/settings.yml
+4
@@ -58,6 +58,10 @@ enabled_plugins:
58 # - '(.*\.)?wikipedia.org$'
59
60 engines:
61 + - name: radio_browser
62 + disabled: true
63 +# TODO enable radio_browser when it works again
64 +# currently it crashes on x86 on gethostbyaddr
65
66 # - name: fdroid
67 # disabled: false
docker/run/fs/ins/copy_A0.sh
+1
@@ -1,4 +1,5 @@
1 #!/bin/bash
2 +set -e
3
4 # Paths
5 SOURCE_DIR="/git/agent-zero"
docker/run/fs/ins/install_A0.sh
-13
@@ -24,22 +24,9 @@ git clone -b "$BRANCH" "https://github.com/frdel/agent-zero" "/git/agent-zero" |
24 # # Install some packages in specific variants
25 # pip install torch --index-url https://download.pytorch.org/whl/cpu
26
27 -uv pip install -v mcp==1.3.0 || {
28 - echo "ERROR: Failed during separate attempt to install mcp==1.3.0. Will proceed to full requirements.txt install anyway."
29 -}
30 -python -c "import mcp; from mcp import ClientSession; print(f'DEBUG: mcp and mcp.ClientSession imported successfully after separate install. mcp path: {mcp.__file__}')" || {
31 - echo "ERROR: mcp package or mcp.ClientSession NOT importable after separate mcp==1.3.0 installation attempt. Full requirements.txt will run next."
32 -}
33 -
27 # Install remaining A0 python packages
28 uv pip install -r /git/agent-zero/requirements.txt
29
37 -uv pip install langchain-anthropic==0.3.15 # TODO: remove after browser-use update
38 -
39 -python -c "import mcp; from mcp import ClientSession; print(f'DEBUG: mcp and mcp.ClientSession imported successfully after requirements.txt. mcp path: {mcp.__file__}')" || {
40 - echo "CRITICAL ERROR: mcp package or mcp.ClientSession not found or failed to import after requirements.txt processing."
41 -}
42 -
30 # install playwright
31 bash /ins/install_playwright.sh "$@"
32
docker/run/fs/ins/install_A02.sh
+1
@@ -1,4 +1,5 @@
1 #!/bin/bash
2 +set -e
3
4 # cachebuster script, this helps speed up docker builds
5
docker/run/fs/ins/install_additional.sh
+1
@@ -1,4 +1,5 @@
1 #!/bin/bash
2 +set -e
3
4 # install playwright - moved to install A0
5 # bash /ins/install_playwright.sh "$@"
docker/run/fs/ins/install_playwright.sh
+3 -8
@@ -1,4 +1,5 @@
1 #!/bin/bash
2 +set -e
3
4 # activate venv
5 . "/ins/setup_venv.sh" "$@"
@@ -10,11 +11,5 @@ uv pip install playwright
11 export PLAYWRIGHT_BROWSERS_PATH=/a0/tmp/playwright
12
13 # install chromium with dependencies
13 -# for kali-based
14 -# if [ "$@" = "hacking" ]; then
15 - apt-get install -y fonts-unifont libnss3 libnspr4 libatk1.0-0 libatspi2.0-0 libxcomposite1 libxdamage1 libatk-bridge2.0-0 libcups2
16 - playwright install chromium --only-shell
17 -# else
18 -# # for debian based
19 -# playwright install --with-deps chromium
20 -# fi
14 +apt-get install -y fonts-unifont libnss3 libnspr4 libatk1.0-0 libatspi2.0-0 libxcomposite1 libxdamage1 libatk-bridge2.0-0 libcups2
15 +playwright install chromium --only-shell
docker/run/fs/ins/post_install.sh
+1
@@ -1,4 +1,5 @@
1 #!/bin/bash
2 +set -e
3
4 # Cleanup package list
5 rm -rf /var/lib/apt/lists/*
docker/run/fs/ins/pre_install.sh
+1
@@ -1,4 +1,5 @@
1 #!/bin/bash
2 +set -e
3
4 # fix permissions for cron files
5 chmod 0644 /etc/cron.d/*
docker/run/fs/ins/setup_ssh.sh
+1
@@ -1,4 +1,5 @@
1 #!/bin/bash
2 +set -e
3
4 # Set up SSH
5 mkdir -p /var/run/sshd && \
docker/run/fs/ins/setup_venv.sh
+1
@@ -1,4 +1,5 @@
1 #!/bin/bash
2 +set -e
3
4 # this has to be ready from base image
5 # if [ ! -d /opt/venv ]; then