b4a9d82d05
Replace docker/metadata GH Action with a docker-publish.sh driven workflow (supports auto-versioning, extra tags, multi-arch builds and optional builder). Update docs and READMEs to use the updater and new publish flow. Add server-side swarm/node blocklist support and admin nodes API. Improve auth endpoints (me, logout, switch, session accounts) and support account switching. Extend bots API to support custom LLM provider and optional endpoint. Enforce node blocklist on chat send/receive, refactor link preview handling into dedicated preview modules, and enhance notifications and posts like/repost handlers to accept both signed actions and regular auth flows. Misc: remove admin update UI details, add helper libs (media previews, node-blocklist, reposts, notifications, etc.), and minor housekeeping (pyc, workflow tweaks).
121 lines
3.1 KiB
Bash
Executable File
121 lines
3.1 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -eu
|
|
|
|
IMAGE_REPO="${IMAGE_REPO:-ghcr.io/gnosyslabs/synapsis}"
|
|
PACKAGE_API="${PACKAGE_API:-/orgs/GnosysLabs/packages/container/synapsis/versions?per_page=100}"
|
|
BUILDER="${BUILDER:-}"
|
|
PLATFORMS="${PLATFORMS:-linux/amd64,linux/arm64}"
|
|
DATE_PREFIX="${DATE_PREFIX:-$(date -u +%Y.%m.%d)}"
|
|
SOURCE_REPO="${SOURCE_REPO:-https://github.com/GnosysLabs/Synapsis}"
|
|
PRUNE_BUILD_CACHE="${PRUNE_BUILD_CACHE:-1}"
|
|
APP_VERSION="${APP_VERSION:-}"
|
|
EXTRA_TAGS="${EXTRA_TAGS:-}"
|
|
|
|
require_command() {
|
|
if ! command -v "$1" >/dev/null 2>&1; then
|
|
echo "❌ Required command not found: $1" >&2
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
require_command docker
|
|
require_command gh
|
|
require_command git
|
|
|
|
CURRENT_SHA="$(git rev-parse --short HEAD)"
|
|
CURRENT_FULL_SHA="$(git rev-parse HEAD)"
|
|
BUILD_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
GITHUB_URL="${SOURCE_REPO}/commit/${CURRENT_FULL_SHA}"
|
|
|
|
if [ -z "${APP_VERSION}" ]; then
|
|
existing_tags="$(
|
|
gh api "${PACKAGE_API}" --paginate --jq '.[].metadata.container.tags[]?' 2>/dev/null || true
|
|
)"
|
|
|
|
max_build=0
|
|
for tag in ${existing_tags}; do
|
|
case "${tag}" in
|
|
"${DATE_PREFIX}".*)
|
|
build_number="${tag##${DATE_PREFIX}.}"
|
|
case "${build_number}" in
|
|
''|*[!0-9]*)
|
|
;;
|
|
*)
|
|
if [ "${build_number}" -gt "${max_build}" ]; then
|
|
max_build="${build_number}"
|
|
fi
|
|
;;
|
|
esac
|
|
;;
|
|
esac
|
|
done
|
|
|
|
next_build=$((max_build + 1))
|
|
APP_VERSION="${DATE_PREFIX}.${next_build}"
|
|
fi
|
|
|
|
BUILD_ARGS="
|
|
--platform ${PLATFORMS}
|
|
--build-arg APP_VERSION=${APP_VERSION}
|
|
--build-arg APP_COMMIT=${CURRENT_FULL_SHA}
|
|
--build-arg APP_BUILD_DATE=${BUILD_DATE}
|
|
--build-arg APP_GITHUB_URL=${GITHUB_URL}
|
|
--build-arg APP_IMAGE_REPO=${IMAGE_REPO}
|
|
--build-arg APP_SOURCE_REPO=${SOURCE_REPO}
|
|
"
|
|
|
|
TAG_ARGS="
|
|
-t ${IMAGE_REPO}:latest
|
|
-t ${IMAGE_REPO}:${APP_VERSION}
|
|
-t ${IMAGE_REPO}:${CURRENT_SHA}
|
|
"
|
|
|
|
for extra_tag in ${EXTRA_TAGS}; do
|
|
TAG_ARGS="${TAG_ARGS}
|
|
-t ${IMAGE_REPO}:${extra_tag}"
|
|
done
|
|
|
|
echo "========================================"
|
|
echo " Synapsis Docker Publish"
|
|
echo "========================================"
|
|
echo " Version: ${APP_VERSION}"
|
|
echo " Commit: ${CURRENT_SHA}"
|
|
echo " Build Date: ${BUILD_DATE}"
|
|
echo " Image: ${IMAGE_REPO}"
|
|
echo " Platforms: ${PLATFORMS}"
|
|
echo "========================================"
|
|
|
|
set -- docker buildx build
|
|
|
|
if [ -n "${BUILDER}" ]; then
|
|
set -- "$@" --builder "${BUILDER}"
|
|
fi
|
|
|
|
# shellcheck disable=SC2086
|
|
set -- "$@" $BUILD_ARGS -f docker/Dockerfile
|
|
# shellcheck disable=SC2086
|
|
set -- "$@" $TAG_ARGS --push .
|
|
|
|
"$@"
|
|
|
|
echo ""
|
|
echo "✅ Published:"
|
|
echo " ${IMAGE_REPO}:latest"
|
|
echo " ${IMAGE_REPO}:${APP_VERSION}"
|
|
echo " ${IMAGE_REPO}:${CURRENT_SHA}"
|
|
|
|
for extra_tag in ${EXTRA_TAGS}; do
|
|
echo " ${IMAGE_REPO}:${extra_tag}"
|
|
done
|
|
|
|
if [ "${PRUNE_BUILD_CACHE}" = "1" ]; then
|
|
echo ""
|
|
echo "🧹 Pruning BuildKit cache"
|
|
if [ -n "${BUILDER}" ]; then
|
|
docker buildx prune --builder "${BUILDER}" -af >/dev/null
|
|
else
|
|
docker buildx prune -af >/dev/null
|
|
fi
|
|
fi
|