Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/sxzz/devbox. Declarative Docker setup for a paseo agent dev environment
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637#!/usr/bin/env bash# Build the image from the current tree, tag it with the commit, and switch to it.set -euo pipefailcd "$(dirname "$0")/.."
tag="$(git rev-parse --short HEAD 2>/dev/null || echo init)"[[ -z "$(git status --porcelain)" ]] || tag="$tag-dirty"
set -a. ./.envset +amkdir -p "$DATA_DIR/paseo-home" "$DATA_DIR/browser-config" "$DATA_DIR/tailscale"
docker compose build --pull --build-arg TOOLS_CACHE_BUST="$(date +%s)" paseodocker tag devbox:latest "devbox:$tag"# /workspace used to be a separate mount; it now lives inside the home mount (see# the Dockerfile) so pnpm can hardlink between projects and worktrees. Move the# old directory right before switching containers so running agents keep theirs.if [[ -d $DATA_DIR/workspace && ! -e $DATA_DIR/paseo-home/workspace ]]; then mv "$DATA_DIR/workspace" "$DATA_DIR/paseo-home/workspace"fimkdir -p "$DATA_DIR/paseo-home/workspace"docker compose up -decho "devbox is running devbox:$tag"
# Every build reinstalls the toolchain into a fresh ~1 GB layer, so old images# pile up. Keep the newest few for scripts/rollback and drop the rest; tags# sharing an image count once, and the running image is always kept.keep=3current="$(docker image inspect -f '{{.Id}}' devbox:latest)"docker image ls devbox --no-trunc --format '{{.ID}}' | awk '!seen[$0]++' | tail -n +"$((keep + 1))" | while read -r id; do [[ $id == "$current" ]] && continue docker image ls devbox --no-trunc --format '{{.ID}} {{.Repository}}:{{.Tag}}' | awk -v id="$id" '$1 == id { print $2 }' | xargs docker image rm || true done