build.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/usr/bin/env bash
  2. set -ex
  3. cd "$(dirname "$0")"/..
  4. eval "$(ci/channel-info.sh)"
  5. source ci/rust-version.sh
  6. source ci/docker/env.sh
  7. CHANNEL_OR_TAG=
  8. if [[ -n "$CI_TAG" ]]; then
  9. CHANNEL_OR_TAG=$CI_TAG
  10. else
  11. CHANNEL_OR_TAG=$CHANNEL
  12. fi
  13. if [[ -z $CHANNEL_OR_TAG ]]; then
  14. echo Unable to determine channel or tag to publish into, exiting.
  15. echo "^^^ +++"
  16. exit 0
  17. fi
  18. cd "$(dirname "$0")"
  19. rm -rf usr/
  20. ../ci/docker-run-default-image.sh scripts/cargo-install-all.sh docker-solana/usr
  21. cp -f ../scripts/run.sh usr/bin/solana-run.sh
  22. cp -f ../fetch-core-bpf.sh usr/bin/
  23. cp -f ../fetch-spl.sh usr/bin/
  24. cp -f ../fetch-programs.sh usr/bin/
  25. (
  26. cd usr/bin
  27. ./fetch-core-bpf.sh
  28. ./fetch-spl.sh
  29. )
  30. docker build \
  31. --build-arg "BASE_IMAGE=${CI_DOCKER_ARG_BASE_IMAGE}" \
  32. -t anzaxyz/agave:"$CHANNEL_OR_TAG" .
  33. maybeEcho=
  34. if [[ -z $CI ]]; then
  35. echo "Not CI, skipping |docker push|"
  36. maybeEcho="echo"
  37. else
  38. (
  39. set +x
  40. if [[ -n $DOCKER_PASSWORD && -n $DOCKER_USERNAME ]]; then
  41. echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
  42. fi
  43. )
  44. fi
  45. $maybeEcho docker push anzaxyz/agave:"$CHANNEL_OR_TAG"