From ff14e743ea8698116d1ea74ccc75e728a8529dd5 Mon Sep 17 00:00:00 2001 From: Gabriel Trigo Date: Sun, 11 Jan 2026 00:06:19 +0000 Subject: [PATCH] feat(docker): optional apt packages in docker-setup --- Dockerfile | 7 +++++++ docker-setup.sh | 10 ++++++++-- docs/install/docker.md | 19 +++++++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index e63b25975..c7c5eb507 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,13 @@ RUN corepack enable WORKDIR /app +ARG CLAWDBOT_DOCKER_APT_PACKAGES="" +RUN if [ -n "$CLAWDBOT_DOCKER_APT_PACKAGES" ]; then \ + apt-get update && \ + apt-get install -y --no-install-recommends $CLAWDBOT_DOCKER_APT_PACKAGES && \ + rm -rf /var/lib/apt/lists/*; \ + fi + COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./ COPY ui/package.json ./ui/package.json COPY patches ./patches diff --git a/docker-setup.sh b/docker-setup.sh index d24a31611..3e7164d26 100755 --- a/docker-setup.sh +++ b/docker-setup.sh @@ -30,6 +30,7 @@ export CLAWDBOT_GATEWAY_PORT="${CLAWDBOT_GATEWAY_PORT:-18789}" export CLAWDBOT_BRIDGE_PORT="${CLAWDBOT_BRIDGE_PORT:-18790}" export CLAWDBOT_GATEWAY_BIND="${CLAWDBOT_GATEWAY_BIND:-lan}" export CLAWDBOT_IMAGE="$IMAGE_NAME" +export CLAWDBOT_DOCKER_APT_PACKAGES="${CLAWDBOT_DOCKER_APT_PACKAGES:-}" if [[ -z "${CLAWDBOT_GATEWAY_TOKEN:-}" ]]; then if command -v openssl >/dev/null 2>&1; then @@ -161,10 +162,15 @@ upsert_env "$ENV_FILE" \ CLAWDBOT_GATEWAY_TOKEN \ CLAWDBOT_IMAGE \ CLAWDBOT_EXTRA_MOUNTS \ - CLAWDBOT_HOME_VOLUME + CLAWDBOT_HOME_VOLUME \ + CLAWDBOT_DOCKER_APT_PACKAGES echo "==> Building Docker image: $IMAGE_NAME" -docker build -t "$IMAGE_NAME" -f "$ROOT_DIR/Dockerfile" "$ROOT_DIR" +docker build \ + --build-arg "CLAWDBOT_DOCKER_APT_PACKAGES=${CLAWDBOT_DOCKER_APT_PACKAGES}" \ + -t "$IMAGE_NAME" \ + -f "$ROOT_DIR/Dockerfile" \ + "$ROOT_DIR" echo "" echo "==> Onboarding (interactive)" diff --git a/docs/install/docker.md b/docs/install/docker.md index 7949e67ee..5536cbf3f 100644 --- a/docs/install/docker.md +++ b/docs/install/docker.md @@ -109,6 +109,25 @@ Notes: extra compose file. - The named volume persists until removed with `docker volume rm `. +### Install extra apt packages (optional) + +If you need system packages inside the image (for example, build tools or media +libraries), set `CLAWDBOT_DOCKER_APT_PACKAGES` before running `docker-setup.sh`. +This installs the packages during the image build, so they persist even if the +container is deleted. + +Example: + +```bash +export CLAWDBOT_DOCKER_APT_PACKAGES="ffmpeg build-essential" +./docker-setup.sh +``` + +Notes: +- This accepts a space-separated list of apt package names. +- If you change `CLAWDBOT_DOCKER_APT_PACKAGES`, rerun `docker-setup.sh` to rebuild + the image. + ### Faster rebuilds (recommended) To speed up rebuilds, order your Dockerfile so dependency layers are cached.