cirque_android_docker_build.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/env bash
  2. #
  3. # Copyright (c) 2021 Project CHIP Authors
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. # cirque_android_docker_build.sh - utility for building and (optionally)
  18. # pushing the Cirque Android Emulator Docker image.
  19. #
  20. # Example usage:
  21. # $ ./cirque_android_docker_build.sh --push
  22. #
  23. set -ex
  24. CHIP_ROOT="$(dirname "$0")/../.."
  25. CIRQUE_RESOURCES=$CHIP_ROOT/third_party/cirque/repo/cirque/resources
  26. ORG=connectedhomeip
  27. IMAGE=android-emulator
  28. TAG=latest
  29. ARGS=()
  30. usage() {
  31. echo "Usage: $0 [--tag <tag> --push]" >&2
  32. exit 0
  33. }
  34. while (($#)); do
  35. case "$1" in
  36. --tag)
  37. TAG="$2"
  38. shift
  39. ;;
  40. --push) ARGS+=("--push") ;;
  41. --help) usage ;;
  42. esac
  43. shift
  44. done
  45. docker buildx build -t "$ORG/$IMAGE:$TAG" -f "$CIRQUE_RESOURCES"/Dockerfile.android_emulator "${ARGS[@]}" "$CIRQUE_RESOURCES"