container.sh 854 B

123456789101112131415161718192021222324
  1. #!/bin/sh
  2. set -e
  3. # Development container builder
  4. #
  5. # Must authenticate first: https://docs.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages#authenticating-to-github-packages
  6. # env vars:
  7. # $EARTHLY_BUILD_BRANCH: git branch to checkout
  8. # $EARTHLY_BUILD_TAG: tag for container image
  9. EARTHLY_IMAGE_NAME="owncast"
  10. BUILD_TAG=${EARTHLY_BUILD_TAG:-develop}
  11. DATE=$(date +"%Y%m%d")
  12. VERSION="${DATE}-${BUILD_TAG}"
  13. echo "Building container image ${EARTHLY_IMAGE_NAME}:${BUILD_TAG} ..."
  14. # Change to the root directory of the repository
  15. cd "$(git rev-parse --show-toplevel)" || exit
  16. if [ -n "${EARTHLY_BUILD_BRANCH}" ]; then
  17. git checkout "${EARTHLY_BUILD_BRANCH}" || exit
  18. fi
  19. earthly --ci +docker-all --images="ghcr.io/owncast/${EARTHLY_IMAGE_NAME}:${BUILD_TAG}" --version="${VERSION}"