#!/usr/bin/env bash set -euo pipefail root_dir="$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)" container="${DISCOURSE_CONTAINER:-app}" plugin_path="/var/www/discourse/plugins/itosm-admin-korean" cd "$root_dir" corepack yarn test docker inspect "$container" >/dev/null docker exec "$container" mkdir -p "$plugin_path/config/locales" "$plugin_path/assets" docker cp plugin.rb "$container:$plugin_path/plugin.rb" docker cp config/locales/client.ko.yml "$container:$plugin_path/config/locales/client.ko.yml" docker cp config/locales/server.ko.yml "$container:$plugin_path/config/locales/server.ko.yml" docker cp assets/. "$container:$plugin_path/assets/" docker restart "$container" >/dev/null for attempt in 1 2 3 4 5 6 7 8 9 10; do if DISCOURSE_CONTAINER="$container" bash scripts/verify_deployment.sh; then echo "Discourse 한국어 보완 배포 완료" exit 0 fi sleep 2 done echo "컨테이너 재시작 뒤 서비스가 정상 상태로 돌아오지 않았습니다." >&2 exit 1