#!/bin/bash

set -e

echo "开始安装 Docker Compose..."

# 定义下载地址和安装路径
DOWNLOAD_URL="http://8.134.164.78:1778/docker-compose-linux-x86_64"
INSTALL_PATH="/usr/local/bin/docker-compose"

# 检查 curl 或 wget
if command -v curl &> /dev/null; then
    echo "使用 curl 下载"
    sudo curl -L "$DOWNLOAD_URL" -o "$INSTALL_PATH"
elif command -v wget &> /dev/null; then
    echo "使用 wget 下载"
    sudo wget "$DOWNLOAD_URL" -O "$INSTALL_PATH"
else
    echo "错误：请先安装 curl 或 wget"
    exit 1
fi

# 设置可执行权限
sudo chmod +x "$INSTALL_PATH"

# 验证安装
echo "安装完成，验证版本："
docker-compose --version
