feat(docker): optional apt packages in docker-setup
This commit is contained in:
committed by
Peter Steinberger
parent
f5670cae06
commit
ff14e743ea
@@ -8,6 +8,13 @@ RUN corepack enable
|
|||||||
|
|
||||||
WORKDIR /app
|
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 package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
|
||||||
COPY ui/package.json ./ui/package.json
|
COPY ui/package.json ./ui/package.json
|
||||||
COPY patches ./patches
|
COPY patches ./patches
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ export CLAWDBOT_GATEWAY_PORT="${CLAWDBOT_GATEWAY_PORT:-18789}"
|
|||||||
export CLAWDBOT_BRIDGE_PORT="${CLAWDBOT_BRIDGE_PORT:-18790}"
|
export CLAWDBOT_BRIDGE_PORT="${CLAWDBOT_BRIDGE_PORT:-18790}"
|
||||||
export CLAWDBOT_GATEWAY_BIND="${CLAWDBOT_GATEWAY_BIND:-lan}"
|
export CLAWDBOT_GATEWAY_BIND="${CLAWDBOT_GATEWAY_BIND:-lan}"
|
||||||
export CLAWDBOT_IMAGE="$IMAGE_NAME"
|
export CLAWDBOT_IMAGE="$IMAGE_NAME"
|
||||||
|
export CLAWDBOT_DOCKER_APT_PACKAGES="${CLAWDBOT_DOCKER_APT_PACKAGES:-}"
|
||||||
|
|
||||||
if [[ -z "${CLAWDBOT_GATEWAY_TOKEN:-}" ]]; then
|
if [[ -z "${CLAWDBOT_GATEWAY_TOKEN:-}" ]]; then
|
||||||
if command -v openssl >/dev/null 2>&1; then
|
if command -v openssl >/dev/null 2>&1; then
|
||||||
@@ -161,10 +162,15 @@ upsert_env "$ENV_FILE" \
|
|||||||
CLAWDBOT_GATEWAY_TOKEN \
|
CLAWDBOT_GATEWAY_TOKEN \
|
||||||
CLAWDBOT_IMAGE \
|
CLAWDBOT_IMAGE \
|
||||||
CLAWDBOT_EXTRA_MOUNTS \
|
CLAWDBOT_EXTRA_MOUNTS \
|
||||||
CLAWDBOT_HOME_VOLUME
|
CLAWDBOT_HOME_VOLUME \
|
||||||
|
CLAWDBOT_DOCKER_APT_PACKAGES
|
||||||
|
|
||||||
echo "==> Building Docker image: $IMAGE_NAME"
|
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 ""
|
||||||
echo "==> Onboarding (interactive)"
|
echo "==> Onboarding (interactive)"
|
||||||
|
|||||||
@@ -109,6 +109,25 @@ Notes:
|
|||||||
extra compose file.
|
extra compose file.
|
||||||
- The named volume persists until removed with `docker volume rm <name>`.
|
- The named volume persists until removed with `docker volume rm <name>`.
|
||||||
|
|
||||||
|
### 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)
|
### Faster rebuilds (recommended)
|
||||||
|
|
||||||
To speed up rebuilds, order your Dockerfile so dependency layers are cached.
|
To speed up rebuilds, order your Dockerfile so dependency layers are cached.
|
||||||
|
|||||||
Reference in New Issue
Block a user