build.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/usr/bin/env bash
  2. # Licensed to the Apache Software Foundation (ASF) under one or more
  3. # contributor license agreements. See the NOTICE file distributed with
  4. # this work for additional information regarding copyright ownership.
  5. # The ASF licenses this file to You under the Apache License, Version 2.0
  6. # (the "License"); you may not use this file except in compliance with
  7. # the License. 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. DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  17. set -eu
  18. mkdir -p build
  19. rat_version=0.16.1
  20. if [ ! -d "$DIR/build/apache-rat-${rat_version}" ]; then
  21. url="https://dlcdn.apache.org/creadur/apache-rat-${rat_version}/apache-rat-${rat_version}-bin.tar.gz"
  22. output="$DIR/build/apache-rat.tar.gz"
  23. if type wget 2> /dev/null; then
  24. wget -O "$output" "$url"
  25. elif type curl 2> /dev/null; then
  26. curl -LSs -o "$output" "$url"
  27. else
  28. exit 1
  29. fi
  30. cd $DIR/build
  31. tar zvxf apache-rat.tar.gz
  32. cd -
  33. fi
  34. java -jar $DIR/build/apache-rat-${rat_version}/apache-rat-${rat_version}.jar $DIR -e .dockerignore -e public -e apache-rat-${rat_version} -e .git -e .gitignore
  35. if [[ $# -ge 1 ]]; then
  36. for v in "$@"; do
  37. docker build --progress plain --build-arg "JAVA_VERSION=$v" -t apache/hadoop-runner:jdk${v}-dev .
  38. done
  39. else
  40. docker build --progress plain -t apache/hadoop-runner:dev .
  41. fi