You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
959 B

  1. #!/bin/bash
  2. SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  3. cd "$SCRIPT_DIR/.."
  4. PHP_VERSIONS=(74 81 82 83)
  5. set -e
  6. ONLY_PUSH=$2
  7. function dot_version() {
  8. sed -r 's/^([[:digit:]])/\1./g' <<< $1
  9. }
  10. if [ -z "${ONLY_PUSH}" ]; then
  11. for PHP_VERSION in "${PHP_VERSIONS[@]}"; do
  12. PHP_IMAGE=$(dot_version "${PHP_VERSION}")
  13. echo $PHP_IMAGE
  14. docker-compose build "php${PHP_VERSION}" && \
  15. docker tag "src-php${PHP_VERSION}" "dimti/php:${PHP_IMAGE}"
  16. docker-compose build "workspace${PHP_VERSION}" && \
  17. docker tag "src-workspace${PHP_VERSION}" "dimti/workspace:${PHP_IMAGE}"
  18. done
  19. fi
  20. WITH_PUSH=$1
  21. if [ -n "${WITH_PUSH}" ]; then
  22. for PHP_VERSION in "${PHP_VERSIONS[@]}"; do
  23. PHP_IMAGE=$(dot_version "${PHP_VERSION}")
  24. echo "Push $PHP_IMAGE"
  25. echo
  26. docker push "dimti/php:${PHP_IMAGE}" && \
  27. docker push "dimti/workspace:${PHP_IMAGE}"
  28. echo
  29. done
  30. fi