|
| 1 | +#!/usr/bin/env bash |
| 2 | +# pull-images.sh — Pull Chronicle images from DockerHub and retag them locally |
| 3 | +# |
| 4 | +# Usage: |
| 5 | +# DOCKERHUB_USERNAME=myuser ./scripts/pull-images.sh v1.0.0 |
| 6 | +# |
| 7 | +# After pulling, start with the prebuilt images: |
| 8 | +# DOCKERHUB_USERNAME=myuser ./start.sh --use-prebuilt v1.0.0 |
| 9 | + |
| 10 | +set -euo pipefail |
| 11 | + |
| 12 | +# ── Colour helpers ───────────────────────────────────────────────────────────── |
| 13 | +RED='\033[0;31m' |
| 14 | +GREEN='\033[0;32m' |
| 15 | +YELLOW='\033[1;33m' |
| 16 | +CYAN='\033[0;36m' |
| 17 | +BOLD='\033[1m' |
| 18 | +RESET='\033[0m' |
| 19 | + |
| 20 | +info() { echo -e "${CYAN}ℹ️ $*${RESET}"; } |
| 21 | +success() { echo -e "${GREEN}✅ $*${RESET}"; } |
| 22 | +warn() { echo -e "${YELLOW}⚠️ $*${RESET}"; } |
| 23 | +error() { echo -e "${RED}❌ $*${RESET}" >&2; } |
| 24 | + |
| 25 | +# ── Validate inputs ──────────────────────────────────────────────────────────── |
| 26 | +if [[ -z "${DOCKERHUB_USERNAME:-}" ]]; then |
| 27 | + error "DOCKERHUB_USERNAME env var is required." |
| 28 | + echo " Example: DOCKERHUB_USERNAME=myuser ./scripts/pull-images.sh v1.0.0" >&2 |
| 29 | + exit 1 |
| 30 | +fi |
| 31 | + |
| 32 | +TAG="${1:-}" |
| 33 | +if [[ -z "$TAG" ]]; then |
| 34 | + error "TAG argument is required." |
| 35 | + echo " Example: DOCKERHUB_USERNAME=myuser ./scripts/pull-images.sh v1.0.0" >&2 |
| 36 | + exit 1 |
| 37 | +fi |
| 38 | + |
| 39 | +REGISTRY="${DOCKERHUB_USERNAME}/" |
| 40 | + |
| 41 | +# ── Image inventory ──────────────────────────────────────────────────────────── |
| 42 | +# Format: "local-image-name:registry-image-name" |
| 43 | +# After pulling, each remote image is retagged to "<local-image-name>:<TAG>" |
| 44 | +# so that docker-compose can find it when CHRONICLE_TAG=<TAG> is set. |
| 45 | +IMAGES=( |
| 46 | + "chronicle-backend:chronicle-backend" |
| 47 | + "chronicle-webui:chronicle-webui" |
| 48 | + "chronicle-speaker:chronicle-speaker" |
| 49 | + "chronicle-speaker-strixhalo:chronicle-speaker-strixhalo" |
| 50 | + "chronicle-speaker-webui:chronicle-speaker-webui" |
| 51 | + "chronicle-asr-nemo:chronicle-asr-nemo" |
| 52 | + "chronicle-asr-nemo-strixhalo:chronicle-asr-nemo-strixhalo" |
| 53 | + "chronicle-asr-faster-whisper:chronicle-asr-faster-whisper" |
| 54 | + "chronicle-asr-vibevoice:chronicle-asr-vibevoice" |
| 55 | + "chronicle-asr-vibevoice-strixhalo:chronicle-asr-vibevoice-strixhalo" |
| 56 | + "chronicle-asr-transformers:chronicle-asr-transformers" |
| 57 | + "chronicle-asr-qwen3-wrapper:chronicle-asr-qwen3-wrapper" |
| 58 | + "chronicle-asr-qwen3-bridge:chronicle-asr-qwen3-bridge" |
| 59 | + "chronicle-havpe-relay:chronicle-havpe-relay" |
| 60 | +) |
| 61 | + |
| 62 | +echo "" |
| 63 | +echo -e "${BOLD}Chronicle Image Pull${RESET}" |
| 64 | +echo -e " Registry : ${REGISTRY}" |
| 65 | +echo -e " Tag : ${TAG}" |
| 66 | +echo "" |
| 67 | + |
| 68 | +# ── Pull loop ───────────────────────────────────────────────────────────────── |
| 69 | +PULLED=() |
| 70 | +FAILED=() |
| 71 | + |
| 72 | +for entry in "${IMAGES[@]}"; do |
| 73 | + LOCAL_BASE="${entry%%:*}" |
| 74 | + REMOTE_BASE="${REGISTRY}${entry##*:}" |
| 75 | + REMOTE_TAG="${REMOTE_BASE}:${TAG}" |
| 76 | + LOCAL_TAG="${LOCAL_BASE}:${TAG}" |
| 77 | + |
| 78 | + echo -e "${CYAN}── ${entry##*:}${RESET}" |
| 79 | + info " Pulling ← ${REMOTE_TAG}" |
| 80 | + |
| 81 | + if docker pull "${REMOTE_TAG}"; then |
| 82 | + # Retag to local name so docker-compose finds it with CHRONICLE_TAG=<TAG> |
| 83 | + info " Retagging → ${LOCAL_TAG}" |
| 84 | + docker tag "${REMOTE_TAG}" "${LOCAL_TAG}" |
| 85 | + success " Ready as ${LOCAL_TAG}" |
| 86 | + PULLED+=("${entry##*:}") |
| 87 | + else |
| 88 | + warn " Not found on DockerHub — skipping (this service may not have been pushed)" |
| 89 | + FAILED+=("${entry##*:}") |
| 90 | + fi |
| 91 | + echo "" |
| 92 | +done |
| 93 | + |
| 94 | +# ── Summary ─────────────────────────────────────────────────────────────────── |
| 95 | +echo -e "${BOLD}── Summary ──────────────────────────────────────────────────────${RESET}" |
| 96 | +printf "%-40s %s\n" "Image" "Status" |
| 97 | +printf "%-40s %s\n" "─────────────────────────────────────" "──────" |
| 98 | + |
| 99 | +for entry in "${IMAGES[@]}"; do |
| 100 | + IMAGE_NAME="${entry##*:}" |
| 101 | + STATUS="" |
| 102 | + for p in "${PULLED[@]}"; do |
| 103 | + [[ "$p" == "$IMAGE_NAME" ]] && STATUS="${GREEN}pulled${RESET}" && break |
| 104 | + done |
| 105 | + for f in "${FAILED[@]}"; do |
| 106 | + [[ "$f" == "$IMAGE_NAME" ]] && STATUS="${YELLOW}not found${RESET}" && break |
| 107 | + done |
| 108 | + [[ -z "$STATUS" ]] && STATUS="${YELLOW}not found${RESET}" |
| 109 | + printf "%-40s " "${IMAGE_NAME}" |
| 110 | + echo -e "${STATUS}" |
| 111 | +done |
| 112 | + |
| 113 | +echo "" |
| 114 | +if [[ ${#PULLED[@]} -gt 0 ]]; then |
| 115 | + success "Pulled ${#PULLED[@]} image(s) tagged as ${TAG}" |
| 116 | + echo "" |
| 117 | + echo "Start services with prebuilt images:" |
| 118 | + echo -e " ${BOLD}DOCKERHUB_USERNAME=${DOCKERHUB_USERNAME} ./start.sh --use-prebuilt ${TAG}${RESET}" |
| 119 | +fi |
| 120 | +if [[ ${#FAILED[@]} -gt 0 ]]; then |
| 121 | + warn "${#FAILED[@]} image(s) not found on DockerHub (these services will fall back to local builds)" |
| 122 | +fi |
0 commit comments