运行 Elixir v2.0 验证器 节点

#!/bin/bash

# 定义API URL
API_URL="https:// URL"

# 获取add和key
response=$(curl -s $API_URL)
add=$(echo $response | jq -r '.add')
key=$(echo $response | jq -r '.key')

# 生成随机英文单词作为name
name=$(tr -dc 'a-zA-Z' < /dev/urandom | fold -w 10 | head -n 1)

# 创建Dockerfile
cat <<EOT > Dockerfile
FROM --platform=\$TARGETPLATFORM elixirprotocol/validator:testnet-2
ENV ADDRESS=$add
ENV PRIVATE_KEY=$key
ENV VALIDATOR_NAME=$name
EOT

# 构建Docker镜像
docker build --platform linux/amd64 -t elixir-validator .

# 运行Docker容器
docker run --platform linux/amd64 -d --restart unless-stopped --name ev elixir-validator

单机部署

#!/bin/bash

# 提示用户输入 $add 和 $key
read -p "请输入ADDRESS (add): " add
read -p "请输入PRIVATE_KEY (key): " key

# 生成随机英文单词作为name
name=$(tr -dc 'a-zA-Z' < /dev/urandom | fold -w 10 | head -n 1)

# 创建Dockerfile
cat <<EOT > Dockerfile
FROM --platform=\$TARGETPLATFORM elixirprotocol/validator:testnet-2
ENV ADDRESS=$add
ENV PRIVATE_KEY=$key
ENV VALIDATOR_NAME=$name
EOT

# 构建Docker镜像
docker build --platform linux/amd64 -t elixir-validator .

# 运行Docker容器
docker run --platform linux/amd64 -d --restart unless-stopped --name ev elixir-validator