adapted readme and added dockerized folder for ease of use

This commit is contained in:
AllreadyTaken 2025-10-23 11:28:02 +02:00
parent 1bdc0522d7
commit 2952011628
3 changed files with 147 additions and 2 deletions

View File

@ -337,6 +337,7 @@ pip install cai-framework
Always create a new virtual environment to ensure proper dependency installation when updating CAI.
The following subsections provide a more detailed walkthrough on selected popular Operating Systems. Refer to the [Development](#development) section for developer-related install instructions.
For API Keys env syntax check litellm Documentation. [LiteLLM Documentation](https://docs.litellm.ai/docs/tutorials/installation)
### OS X
```bash
@ -412,13 +413,27 @@ python3 -m venv cai_env
# Install the package from the local directory
source cai_env/bin/activate && pip install cai-framework
# Generate a .env file and set up with defaults
echo -e 'OPENAI_API_KEY="sk-1234"\nANTHROPIC_API_KEY=""\nOLLAMA=""\nPROMPT_TOOLKIT_NO_CPR=1\nCAI_STREAM=false' > .env
# Generate a .env file and set up with defaults. If Ollama runs on your windows host, wsl needs to use host.docker.internal for it to become reachable
echo -e 'OPENAI_API_KEY="sk-1234"\nANTHROPIC_API_KEY=""\nOLLAMA=""\nOLLAMA_API_BASE="http://host.docker.internal:11434"\nPROMPT_TOOLKIT_NO_CPR=1\nCAI_STREAM=false' > .env
# Launch CAI
cai # first launch it can take up to 30 seconds
```
You might run into issues running cai on ubuntu since some agents assume they are running on a Kali Instance and are not able to find the tools needed.
So as an alternative you can use the docker compose file in the dockerized folder instead. This also works from within wsl if docker is installed.
in that case fetch the dockerized folder (no need for the whole repo) and run from within it.
For API Keys env syntax check litellm Documentation. [LiteLLM Documentation](https://docs.litellm.ai/docs/tutorials/installation)
```bash
#build and run docker compose Build takes around 20 min.
docker compose build && docker compose up -d
#access cai
docker compose exec cai cai
```
### Android
We recommend having at least 8 GB of RAM:

76
dockerized/Dockerfile Normal file
View File

@ -0,0 +1,76 @@
# CAI Production Container - Minimalistisch & Effizient
FROM kalilinux/kali-rolling
ENV DEBIAN_FRONTEND=noninteractive
# Fix Kali GPG Keys
RUN apt-get update --allow-insecure-repositories && \
apt-get install -y --no-install-recommends --allow-unauthenticated kali-archive-keyring && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# pentesting stuff
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3 \
python3-pip \
curl \
wget \
git \
nmap \
iputils-ping \
dnsutils \
ca-certificates \
netcat-traditional \
burpsuite \
sqlmap \
nikto \
dirb \
gobuster \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# FIX: pip system-packages Warning (whatever)
RUN mkdir -p /root/.pip && \
echo "[global]" > /root/.pip/pip.conf && \
echo "break-system-packages = true" >> /root/.pip/pip.conf
# pip upgrade
RUN pip3 install --upgrade pip setuptools wheel
WORKDIR /opt/cai
# CAI Framework install
RUN pip3 install cai-framework
# .env Template (overriden by volume mount.. but just to be safe)
RUN echo 'OPENAI_API_KEY="sk-1234"' > /opt/cai/.env && \
echo 'ANTHROPIC_API_KEY=""' >> /opt/cai/.env && \
echo 'DEEPSEEK_API_KEY=""' >> /opt/cai/.env && \
echo 'OLLAMA_API_BASE=""' >> /opt/cai/.env && \
echo 'PROMPT_TOOLKIT_NO_CPR=1' >> /opt/cai/.env && \
echo 'CAI_STREAM=false' >> /opt/cai/.env
# Logs
RUN mkdir -p /opt/cai/logs
# Startup Script
RUN echo '#!/bin/bash' > /opt/cai/start.sh && \
echo 'if [ -f /config/.env ]; then' >> /opt/cai/start.sh && \
echo ' echo "Loading .env from /config/.env"' >> /opt/cai/start.sh && \
echo ' cp /config/.env /opt/cai/.env' >> /opt/cai/start.sh && \
echo 'fi' >> /opt/cai/start.sh && \
echo 'cd /opt/cai' >> /opt/cai/start.sh && \
echo 'exec cai "$@"' >> /opt/cai/start.sh && \
chmod +x /opt/cai/start.sh
# Healthcheck
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python3 -c "import cai; print('OK')" || exit 1
# Default: start cai
ENTRYPOINT ["/opt/cai/start.sh"]
# Fallback other stuff goes here?
CMD []

View File

@ -0,0 +1,54 @@
services:
cai:
build:
context: .
dockerfile: Dockerfile
container_name: cai
# Host-Net for scanning (WSL should do that?)
network_mode: host
# nmap raw sockets
privileged: true
# Volumes
volumes:
# .env file
- ./config/.env:/config/.env:ro
# Logs persistence
- ./logs:/opt/cai/logs
# Optional: Docker socket if cai should use docker should it though?
# - /var/run/docker.sock:/var/run/docker.sock
# WSL: host.docker.internal Access
extra_hosts:
- "host.docker.internal:host-gateway"
# Env Vars (Fallback, .env wins if present)
environment:
- OPENAI_API_KEY=${OPENAI_API_KEY:-sk-1234}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-}
- DEEPSEEK_API_KEY=${DEEPSEEK_API_KEY:-}
- OLLAMA_API_BASE=${OLLAMA:-}
- PROMPT_TOOLKIT_NO_CPR=1
- CAI_STREAM=false
# Interactive
stdin_open: true
tty: true
# Restart
restart: unless-stopped
# Resource Limits? Wsl doesnt like those? Mpf.
deploy:
resources:
limits:
cpus: '4'
memory: 6G
reservations:
cpus: '1'
memory: 2G