项目文件夹

文件
wehub-resource-sync 593b94c120
pytest / Unit Tests (push) Has been cancelled
pytest / Integration (integration_tests_a) (push) Has been cancelled
pytest / Integration (integration_tests_b) (push) Has been cancelled
pytest / Integration (integration_tests_c) (push) Has been cancelled
pytest / Integration (integration_tests_d) (push) Has been cancelled
pytest / Integration (integration_tests_e) (push) Has been cancelled
pytest / Integration (integration_tests_f) (push) Has been cancelled
pytest / Integration (integration_tests_g) (push) Has been cancelled
pytest / Integration (integration_tests_h) (push) Has been cancelled
pytest / Integration (integration_tests_i) (push) Has been cancelled
pytest / Integration (integration_tests_j) (push) Has been cancelled
pytest / Distributed (distributed_a) (push) Has been cancelled
pytest / Distributed (distributed_b) (push) Has been cancelled
pytest / Distributed (distributed_c) (push) Has been cancelled
pytest / Distributed (distributed_d) (push) Has been cancelled
pytest / Distributed (distributed_e) (push) Has been cancelled
pytest / Distributed (distributed_f) (push) Has been cancelled
pytest / Minimal Install (push) Has been cancelled
pytest / Event File (push) Has been cancelled
pytest (slow) / py-slow (push) Has been cancelled
Publish JSON Schema / publish-schema (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:49:20 +08:00

75 行
1.8 KiB
Bash
可执行文件

#!/usr/bin/env bash
# Build and push versioned Ludwig Docker images to Docker Hub.
#
# Usage:
# ./docker/build_and_push.sh <version> [--latest]
#
# Examples:
# ./docker/build_and_push.sh 0.14.0 # tags: 0.14.0, 0.14
# ./docker/build_and_push.sh 0.14.0 --latest # tags: 0.14.0, 0.14, latest
#
# Requires: docker login to ludwigai account already done.
set -euo pipefail
if [ $# -lt 1 ]; then
echo "Usage: $0 <version> [--latest]"
echo " version full version to build, e.g. 0.14.0"
echo " --latest also tag as :latest"
exit 1
fi
VERSION="$1"
IS_LATEST=false
if [ "${2:-}" = "--latest" ]; then
IS_LATEST=true
fi
# Derive major.minor tag from full version (e.g. "0.14.0" -> "0.14")
MINOR="${VERSION%.*}"
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
# Image variants: "image_name dockerfile_dir"
VARIANTS=(
"ludwigai/ludwig docker/ludwig"
"ludwigai/ludwig-gpu docker/ludwig-gpu"
"ludwigai/ludwig-ray docker/ludwig-ray"
"ludwigai/ludwig-ray-gpu docker/ludwig-ray-gpu"
)
build_and_push() {
local image="$1"
local dockerfile_dir="$2"
echo ""
echo "=== Building ${image}:${VERSION} ==="
local tag_args="-t ${image}:${VERSION} -t ${image}:${MINOR}"
if [ "${IS_LATEST}" = "true" ]; then
tag_args="${tag_args} -t ${image}:latest"
fi
# shellcheck disable=SC2086
docker build \
--build-arg LUDWIG_VERSION="${VERSION}" \
${tag_args} \
-f "${REPO_ROOT}/${dockerfile_dir}/Dockerfile" \
"${REPO_ROOT}"
echo "--- Pushing ${image}:${VERSION} ---"
docker push "${image}:${VERSION}"
docker push "${image}:${MINOR}"
if [ "${IS_LATEST}" = "true" ]; then
docker push "${image}:latest"
fi
}
for variant_entry in "${VARIANTS[@]}"; do
read -r image dockerfile_dir <<< "${variant_entry}"
build_and_push "${image}" "${dockerfile_dir}"
done
echo ""
echo "All images built and pushed successfully."