|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# This work is licensed and released under GNU GPL v3 or any other later versions. |
| 4 | +# The full text of the license is below/ found at <http://www.gnu.org/licenses/> |
| 5 | + |
| 6 | +# (c) 2023 Rocket Pool Pty Ltd. Modified under GNU GPL v3. [1.4.1] |
| 7 | + |
| 8 | +# This program is free software: you can redistribute it and/or modify |
| 9 | +# it under the terms of the GNU General Public License as published by |
| 10 | +# the Free Software Foundation, either version 3 of the License, or |
| 11 | +# (at your option) any later version. |
| 12 | + |
| 13 | +# This program is distributed in the hope that it will be useful, |
| 14 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | +# GNU General Public License for more details. |
| 17 | + |
| 18 | +# You should have received a copy of the GNU General Public License |
| 19 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | + |
| 21 | +# Get the platform type and run the build script if possible |
| 22 | + |
| 23 | +# Print usage |
| 24 | +usage() { |
| 25 | + echo "Usage: daemon-local.sh -v <version number>" |
| 26 | + exit 0 |
| 27 | +} |
| 28 | + |
| 29 | +DOCKER_ACCOUNT=staderlabs |
| 30 | +# Parse arguments |
| 31 | +while getopts "acpdnlrfv:" FLAG; do |
| 32 | + case "$FLAG" in |
| 33 | + v) VERSION="$OPTARG" ;; |
| 34 | + *) usage ;; |
| 35 | + esac |
| 36 | +done |
| 37 | +if [ -z "$VERSION" ]; then |
| 38 | + usage |
| 39 | +fi |
| 40 | + |
| 41 | +# Get CPU architecture |
| 42 | +UNAME_VAL=$(uname -m) |
| 43 | +ARCH="" |
| 44 | +case $UNAME_VAL in |
| 45 | + x86_64) ARCH="amd64" ;; |
| 46 | + aarch64) ARCH="arm64" ;; |
| 47 | + arm64) ARCH="arm64" ;; |
| 48 | + *) fail "CPU architecture not supported: $UNAME_VAL" ;; |
| 49 | +esac |
| 50 | + |
| 51 | + |
| 52 | +echo "Start buiding: " $VERSION |
| 53 | + |
| 54 | +docker run --rm -v $PWD:/stader-node staderdev/stader-node-builder:latest /stader-node/stader/build.sh |
| 55 | + |
| 56 | +cp stader/stader-daemon-* build/$VERSION |
| 57 | + |
| 58 | +echo "done!" |
| 59 | + |
| 60 | +docker buildx build --platform=linux/$ARCH -t $DOCKER_ACCOUNT/stader-permissionless:$VERSION -f docker/stader-dockerfile --load . || fail "Error building $ARCH Docker Stader Daemon image." |
| 61 | + |
| 62 | +echo "done!" |
0 commit comments