Files
evm/scripts/constants.sh
T
66c57ca626 Fix Dockerfile and add Build Image to GH Actions (#561)
* Remove specified git version to avoid downgrades breaking docker build

* Add build docker image to unit test action

* Update to use current branch instead of commit for docker image build

* Update docker image script to push image if env var is set

* Add new line to build image script

* Update scripts/constants.sh

Co-authored-by: Sam Batschelet <[email protected]>

* Update docker login

* Update build image action

* Update gh action

* checkout for docker image build

* Set build image ID in gh action with github.ref_name

* Separate CI and release

* remove extra copy

* Update name

* Update variable used in build image id

* Update set var

* Update dockerhub repo

* Revert dockerhub repo name chnge and use Subnet-EVM in tag name

---------

Co-authored-by: Sam Batschelet <[email protected]>
2023-03-09 13:44:17 -05:00

45 lines
1.4 KiB
Bash

#!/usr/bin/env bash
# Set the PATHS
GOPATH="$(go env GOPATH)"
# Avalabs docker hub
DOCKERHUB_REPO="avaplatform/avalanchego"
# if this isn't a git repository (say building from a release), don't set our git constants.
if [ ! -d .git ]
then
CURRENT_BRANCH=""
SUBNET_EVM_COMMIT=""
SUBNET_EVM_COMMIT_ID=""
else
# Current branch
CURRENT_BRANCH=${CURRENT_BRANCH:-$(git describe --tags --exact-match 2> /dev/null || git symbolic-ref -q --short HEAD || git rev-parse --short HEAD || :)}
# Image build id
#
# Use an abbreviated version of the full commit to tag the image.
# WARNING: this will use the most recent commit even if there are un-committed changes present
SUBNET_EVM_COMMIT="$(git --git-dir="$SUBNET_EVM_PATH/.git" rev-parse HEAD || :)"
SUBNET_EVM_COMMIT_ID="${SUBNET_EVM_COMMIT::8}"
fi
echo "Using branch: ${CURRENT_BRANCH}"
BUILD_IMAGE_ID=${BUILD_IMAGE_ID:-"${AVALANCHEGO_VERSION}-Subnet-EVM-${CURRENT_BRANCH}"}
# Static compilation
STATIC_LD_FLAGS=''
if [ "${STATIC_COMPILATION:-}" = 1 ]
then
export CC=musl-gcc
command -v $CC || ( echo $CC must be available for static compilation && exit 1 )
STATIC_LD_FLAGS=' -extldflags "-static" -linkmode external '
fi
# Set the CGO flags to use the portable version of BLST
#
# We use "export" here instead of just setting a bash variable because we need
# to pass this flag to all child processes spawned by the shell.
export CGO_CFLAGS="-O -D__BLST_PORTABLE__"