diff --git a/Dockerfile b/Dockerfile index be55d3ae..70a1b9d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,13 +26,21 @@ RUN ARCH=$(cat /tmp/arch) && \ echo "Unsupported architecture: $TARGETARCH" && exit 1; \ fi && \ if [ "${RELEASE}" = "latest" ]; then \ - VERSION="latest"; \ + # For latest, download from GitHub releases using the -latest suffix + PACKAGE_NAME="rustfs-linux-${ARCH}-latest.zip"; \ + # Use GitHub API to get the latest release URL + LATEST_RELEASE_URL=$(curl -s https://api.github.com/repos/rustfs/rustfs/releases/latest | grep -o '"browser_download_url": "[^"]*'"${PACKAGE_NAME}"'"' | cut -d'"' -f4 | head -1); \ + if [ -z "$LATEST_RELEASE_URL" ]; then \ + echo "Failed to find latest release for ${PACKAGE_NAME}" >&2; \ + exit 1; \ + fi; \ + DOWNLOAD_URL="$LATEST_RELEASE_URL"; \ else \ + # For specific versions, construct the GitHub release URL directly VERSION="v${RELEASE#v}"; \ + PACKAGE_NAME="rustfs-linux-${ARCH}-${VERSION}.zip"; \ + DOWNLOAD_URL="https://github.com/rustfs/rustfs/releases/download/${VERSION}/${PACKAGE_NAME}"; \ fi && \ - BASE_URL="https://dl.rustfs.com/artifacts/rustfs/release" && \ - PACKAGE_NAME="rustfs-linux-${ARCH}-${VERSION}.zip" && \ - DOWNLOAD_URL="${BASE_URL}/${PACKAGE_NAME}" && \ echo "Downloading ${PACKAGE_NAME} from ${DOWNLOAD_URL}" >&2 && \ curl -f -L "${DOWNLOAD_URL}" -o rustfs.zip && \ unzip rustfs.zip -d /build && \ diff --git a/docker-buildx.sh b/docker-buildx.sh index bffa62f3..d5770078 100755 --- a/docker-buildx.sh +++ b/docker-buildx.sh @@ -150,11 +150,7 @@ build_and_push() { else print_message $RED "❌ Failed to build latest variant" print_message $YELLOW "💡 Note: Make sure rustfs binaries are available at:" - if [ "$CHANNEL" = "dev" ]; then - print_message $YELLOW " https://dl.rustfs.com/artifacts/rustfs/dev/" - else - print_message $YELLOW " https://dl.rustfs.com/artifacts/rustfs/release/" - fi + print_message $YELLOW " https://github.com/rustfs/rustfs/releases" exit 1 fi @@ -183,11 +179,7 @@ build_and_push() { else print_message $RED "❌ Failed to build release variant" print_message $YELLOW "💡 Note: Make sure rustfs binaries are available at:" - if [ "$CHANNEL" = "dev" ]; then - print_message $YELLOW " https://dl.rustfs.com/artifacts/rustfs/dev/" - else - print_message $YELLOW " https://dl.rustfs.com/artifacts/rustfs/release/" - fi + print_message $YELLOW " https://github.com/rustfs/rustfs/releases" exit 1 fi else @@ -248,7 +240,7 @@ done # Main execution main() { print_message $BLUE "🐳 RustFS Docker Buildx Build Script" - print_message $YELLOW "📋 Build Strategy: Uses pre-built binaries from dl.rustfs.com" + print_message $YELLOW "📋 Build Strategy: Uses pre-built binaries from GitHub Releases" print_message $YELLOW "🚀 Production images only - optimized for distribution" echo ""