#!/usr/bin/env bash # build.sh [data|crawl] [--no-sync] [--pull] [services…] # rsync the repo to the target host and `docker compose build` there (images are built where they run; # the pnpm store / Next cache are BuildKit cache mounts on the host, so rebuilds are incremental). source "$(dirname "${BASH_SOURCE[0]}")/lib.sh" target="${1:-data}"; shift || true check_target "$target" sync=1; pull=""; services=() for a in "$@"; do case "$a" in --no-sync) sync=0 ;; --pull) pull="--pull" ;; *) services+=("$a") ;; esac done [[ $sync == 1 ]] && { ensure_remote_layout "$target"; sync_repo "$target"; } log "docker compose build ($target: $(host_for "$target")) ${services[*]:-all}" compose "$target" "build $pull ${services[*]:-}" ok "built" compose "$target" "images"