Renamed to lorabot
This commit is contained in:
@@ -2,25 +2,43 @@
|
||||
# Build a multi-arch (linux/amd64, linux/arm64) image and push it to a registry.
|
||||
#
|
||||
# Required:
|
||||
# MESHBOT_IMAGE Full image reference, e.g. registry.example.com/team/meshbot
|
||||
# LORABOT_IMAGE Full image reference, e.g. registry.example.com/team/lorabot
|
||||
#
|
||||
# Optional:
|
||||
# PLATFORMS Comma-separated arch list (default: linux/amd64,linux/arm64)
|
||||
# EXTRA_TAGS Space-separated additional tags to push (e.g. "stable v0.1.0")
|
||||
# PUSH "1" (default) to push, "0" to build and load locally only
|
||||
# (note: --load only works with a single platform)
|
||||
# BUILDER buildx builder name (default: meshbot-builder, auto-created)
|
||||
# BUILDER buildx builder name (default: lorabot-builder, auto-created)
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [[ -z "${MESHBOT_IMAGE:-}" ]]; then
|
||||
echo "error: MESHBOT_IMAGE is required (e.g. registry.example.com/team/meshbot)" >&2
|
||||
if [[ -z "${LORABOT_IMAGE:-}" ]]; then
|
||||
echo "error: LORABOT_IMAGE is required (e.g. registry.example.com/team/lorabot)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Preflight: buildx must be installed (it's a separate package on Arch / some
|
||||
# minimal distros). If it's missing, `docker buildx ...` is parsed by docker as
|
||||
# `docker ...` with unknown flags, producing a confusing "unknown flag" error.
|
||||
if ! docker buildx version >/dev/null 2>&1; then
|
||||
echo "error: docker buildx is not available." >&2
|
||||
echo " Arch: sudo pacman -S docker-buildx" >&2
|
||||
echo " Debian/Ubu: sudo apt install docker-buildx-plugin" >&2
|
||||
echo " Other: https://github.com/docker/buildx#installing" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Preflight: daemon reachable.
|
||||
if ! docker info >/dev/null 2>&1; then
|
||||
echo "error: cannot reach the docker daemon (is it running? are you in the 'docker' group?)" >&2
|
||||
echo " Arch: sudo systemctl start docker" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PLATFORMS="${PLATFORMS:-linux/amd64,linux/arm64}"
|
||||
PUSH="${PUSH:-1}"
|
||||
BUILDER="${BUILDER:-meshbot-builder}"
|
||||
BUILDER="${BUILDER:-lorabot-builder}"
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
@@ -34,9 +52,9 @@ else
|
||||
GIT_SHA="dev"
|
||||
fi
|
||||
|
||||
TAGS=(--tag "${MESHBOT_IMAGE}:latest" --tag "${MESHBOT_IMAGE}:${GIT_SHA}")
|
||||
TAGS=(--tag "${LORABOT_IMAGE}:latest" --tag "${LORABOT_IMAGE}:${GIT_SHA}")
|
||||
for t in ${EXTRA_TAGS:-}; do
|
||||
TAGS+=(--tag "${MESHBOT_IMAGE}:${t}")
|
||||
TAGS+=(--tag "${LORABOT_IMAGE}:${t}")
|
||||
done
|
||||
|
||||
# Make sure a buildx builder exists. Reuse if it's already there.
|
||||
@@ -51,7 +69,7 @@ docker buildx inspect --bootstrap >/dev/null
|
||||
OUTPUT_FLAG=()
|
||||
if [[ "${PUSH}" == "1" ]]; then
|
||||
OUTPUT_FLAG=(--push)
|
||||
echo ">>> building & pushing ${MESHBOT_IMAGE} (${PLATFORMS}) tags: latest, ${GIT_SHA}${EXTRA_TAGS:+, $EXTRA_TAGS}"
|
||||
echo ">>> building & pushing ${LORABOT_IMAGE} (${PLATFORMS}) tags: latest, ${GIT_SHA}${EXTRA_TAGS:+, $EXTRA_TAGS}"
|
||||
else
|
||||
# --load only works with a single platform; warn if user requested multi.
|
||||
if [[ "${PLATFORMS}" == *,* ]]; then
|
||||
@@ -59,7 +77,7 @@ else
|
||||
exit 1
|
||||
fi
|
||||
OUTPUT_FLAG=(--load)
|
||||
echo ">>> building ${MESHBOT_IMAGE} for ${PLATFORMS} (local load, no push)"
|
||||
echo ">>> building ${LORABOT_IMAGE} for ${PLATFORMS} (local load, no push)"
|
||||
fi
|
||||
|
||||
docker buildx build \
|
||||
|
||||
Reference in New Issue
Block a user