From b6f7d8bed1defc68c767ff44b0102acf72062df1 Mon Sep 17 00:00:00 2001 From: syui Date: Fri, 20 Feb 2026 07:08:04 +0900 Subject: [PATCH] fix install.zsh --- install.zsh | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 4 deletions(-) diff --git a/install.zsh b/install.zsh index 7ba902f..919f253 100755 --- a/install.zsh +++ b/install.zsh @@ -381,20 +381,66 @@ EOF echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" } +function at-repos-docker-verify() { + local service=$1 + local image="at-${service}:latest" + local check_file="" + case $service in + pds) check_file="/app/services/pds/index.js" ;; + bsky) check_file="/app/services/bsky/api.js" ;; + ozone) check_file="/app/services/ozone/api.js" ;; + bgs) check_file="/bigsky" ;; + plc) check_file="/app/packages/server/dist/index.js" ;; + *) return 0 ;; + esac + if docker run --rm "$image" test -f "$check_file" 2>/dev/null; then + echo " ✅ Verified: $check_file exists" + return 0 + else + echo " ❌ FAILED: $check_file not found in $image" + return 1 + fi +} + function at-repos-build-docker-atproto() { cd $d - docker image prune -a + local failed=() if [ -z "$1" ];then for ((i=1; i<=${#services}; i++)); do service=${services[$i]} - docker compose build --no-cache $service + echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + echo "🔨 Building: $service" + if ! docker compose build --no-cache $service; then + echo " ❌ Build failed: $service" + failed+=($service) + continue + fi + if ! at-repos-docker-verify $service; then + failed+=($service) + continue + fi if [ "$service" = "ozone" ]; then docker compose build --no-cache ${service}-web fi done else - docker compose build --no-cache $1 + echo "🔨 Building: $1" + if ! docker compose build --no-cache $1; then + echo "❌ Build failed: $1" + return 1 + fi + if ! at-repos-docker-verify $1; then + return 1 + fi fi + if [ ${#failed[@]} -gt 0 ]; then + echo "" + echo "❌ Failed builds: ${failed[*]}" + echo "⚠️ Do NOT push these images." + return 1 + fi + echo "" + echo "✅ All builds verified successfully." } function at-repos-push-reset() { @@ -412,25 +458,41 @@ function at-repos-push-reset() { } function at-repos-push-docker() { + local dtag=$(date +%Y%m%d) if [ -z "$1" ] || [ "$1" = "push" ]; then for service in "${services[@]}"; do + if ! at-repos-docker-verify $service; then + echo "⚠️ Skipping push: $service (verification failed)" + continue + fi docker tag at-${service}:latest localhost:${dport}/${service}:latest + docker tag at-${service}:latest localhost:${dport}/${service}:${dtag} docker push localhost:${dport}/${service}:latest + docker push localhost:${dport}/${service}:${dtag} if [ "$service" = "ozone" ]; then docker tag at-${service}-web:latest localhost:${dport}/${service}-web:latest + docker tag at-${service}-web:latest localhost:${dport}/${service}-web:${dtag} docker push localhost:${dport}/${service}-web:latest + docker push localhost:${dport}/${service}-web:${dtag} fi done else + if ! at-repos-docker-verify $1; then + echo "❌ Push aborted: $1 (verification failed)" + return 1 + fi docker tag at-${1}:latest localhost:${dport}/${1}:latest + docker tag at-${1}:latest localhost:${dport}/${1}:${dtag} docker push localhost:${dport}/${1}:latest + docker push localhost:${dport}/${1}:${dtag} fi + echo "📦 Pushed with tags: latest, ${dtag}" } function at-repos-pull-docker() { cd $d - docker image prune -a docker compose up -d --pull always + echo "💡 Run 'docker image prune' manually to clean up old images." } function at-repos-reset-bgs-db() {