2020-11-07 10:49:53 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
if [[ "${USER}" != "{{ beacon_node_builds_user }}" ]]; then
|
|
|
|
echo "Incorrect user: ${USER}" >&2
|
|
|
|
echo "Expected: {{ beacon_node_builds_user }}" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-11-08 23:53:16 +00:00
|
|
|
IMAGE="{{ beacon_node_builds_image_name }}"
|
|
|
|
TAG="{{ item.name }}"
|
2020-11-07 10:49:53 +00:00
|
|
|
|
|
|
|
# Build the Beacon node binaries
|
2020-11-08 23:53:16 +00:00
|
|
|
pushd repo
|
|
|
|
|
|
|
|
COMMIT_BEFORE=$(git rev-parse --short=8 HEAD)
|
|
|
|
git pull
|
|
|
|
COMMIT_AFTER=$(git rev-parse --short=8 HEAD)
|
|
|
|
|
|
|
|
if [[ "$1" == "--force" ]]; then
|
|
|
|
echo "Forcing rebuild!"
|
|
|
|
elif [[ "${COMMIT_BEFORE}" == "${COMMIT_AFTER}" ]]; then
|
|
|
|
echo "Nothing new to build."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
make update
|
|
|
|
make \
|
2020-11-07 10:49:53 +00:00
|
|
|
LOG_LEVEL="TRACE" \
|
|
|
|
MAKEFLAGS="-j$(nproc)" \
|
|
|
|
NIMFLAGS="-d:insecure -d:testnet_servers_image" \
|
2020-11-10 14:39:24 +00:00
|
|
|
{{ item.targets | join(" ") }}
|
2020-11-08 23:53:16 +00:00
|
|
|
|
|
|
|
popd
|
2020-11-07 10:49:53 +00:00
|
|
|
|
|
|
|
# Add binary into a simple Alpine image
|
2020-11-08 23:53:16 +00:00
|
|
|
docker build -t "${IMAGE}:${COMMIT_AFTER}" --build-arg=COMMIT=${COMMIT_AFTER} .
|
|
|
|
docker tag "${IMAGE}:${COMMIT_AFTER}" "${IMAGE}:${TAG}"
|
|
|
|
docker push "${IMAGE}:${COMMIT_AFTER}"
|
|
|
|
docker push "${IMAGE}:${TAG}"
|
|
|
|
|
|
|
|
echo "SUCCESS - pushed: ${IMAGE}:${TAG}"
|