forked from ava-labs/avalanchego
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_xsvm_image.sh
More file actions
executable file
·35 lines (26 loc) · 1.18 KB
/
Copy pathbuild_xsvm_image.sh
File metadata and controls
executable file
·35 lines (26 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
set -euo pipefail
# e.g.,
# ./scripts/build_image.sh # Build local single-arch image
# AVALANCHEGO_IMAGE=localhost:5001/avalanchego ./scripts/build_xsvm_image.sh # Build and push image to private registry
if ! [[ "$0" =~ scripts/build_xsvm_image.sh ]]; then
echo "must be run from repository root"
exit 255
fi
source ./scripts/image_tag.sh
AVALANCHEGO_IMAGE="${AVALANCHEGO_IMAGE:-avalanchego}"
XSVM_IMAGE="${XSVM_IMAGE:-avalanchego-xsvm}"
# Build the avalanchego base image
SKIP_BUILD_RACE=1 DOCKER_IMAGE="${AVALANCHEGO_IMAGE}" bash -x ./scripts/build_image.sh
DOCKER_CMD=("docker" "buildx" "build")
if [[ "${XSVM_IMAGE}" == *"/"* ]]; then
# Push to a registry when the image name includes a slash which indicates the
# use of a registry e.g.
#
# - dockerhub: [repo]/[image name]:[tag]
# - private registry: [private registry hostname]/[image name]:[tag]
DOCKER_CMD+=("--push")
fi
GO_VERSION="$(go list -m -f '{{.GoVersion}}')"
"${DOCKER_CMD[@]}" --build-arg GO_VERSION="${GO_VERSION}" --build-arg AVALANCHEGO_NODE_IMAGE="${AVALANCHEGO_IMAGE}:${image_tag}" \
-t "${XSVM_IMAGE}" -f ./vms/example/xsvm/Dockerfile .