test_run_tarball.sh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/bash
  2. #
  3. # Licensed to the Apache Software Foundation (ASF) under one or more
  4. # contributor license agreements. See the NOTICE file distributed with
  5. # this work for additional information regarding copyright ownership.
  6. # The ASF licenses this file to You under the Apache License, Version 2.0
  7. # (the "License"); you may not use this file except in compliance with
  8. # the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. #
  18. set -e
  19. if [ -z "${SUPERSET_VERSION_RC}" ]; then
  20. echo "SUPERSET_VERSION_RC is required to run this container"
  21. exit 1
  22. fi
  23. if [ -z "${SUPERSET_SVN_DEV_PATH}" ]; then
  24. SUPERSET_SVN_DEV_PATH="$HOME/svn/superset_dev"
  25. fi
  26. if [ ${1} == "local" ]; then
  27. SUPERSET_RELEASE_RC=apache-superset-incubating-"${SUPERSET_VERSION_RC}"
  28. SUPERSET_RELEASE_RC_TARBALL="${SUPERSET_RELEASE_RC}"-source.tar.gz
  29. SUPERSET_TARBALL_PATH="${SUPERSET_SVN_DEV_PATH}"/${SUPERSET_VERSION_RC}/${SUPERSET_RELEASE_RC_TARBALL}
  30. SUPERSET_TMP_TARBALL_FILENAME=_tmp_"${SUPERSET_VERSION_RC}".tar.gz
  31. cp "${SUPERSET_TARBALL_PATH}" "${SUPERSET_TMP_TARBALL_FILENAME}"
  32. docker build --no-cache \
  33. -t apache-superset:${SUPERSET_VERSION_RC} \
  34. -f Dockerfile.from_local_tarball . \
  35. --build-arg VERSION=${SUPERSET_VERSION_RC} \
  36. --build-arg SUPERSET_BUILD_FROM=local \
  37. --build-arg SUPERSET_RELEASE_RC_TARBALL="${SUPERSET_TMP_TARBALL_FILENAME}"
  38. rm "${SUPERSET_TMP_TARBALL_FILENAME}"
  39. else
  40. # Building a docker from a tarball
  41. docker build --no-cache \
  42. -t apache-superset:${SUPERSET_VERSION_RC} \
  43. -f Dockerfile.from_svn_tarball . \
  44. --build-arg VERSION=${SUPERSET_VERSION_RC} \
  45. --build-arg SUPERSET_BUILD_FROM=svn
  46. fi
  47. echo "---------------------------------------------------"
  48. echo "After docker build and run, you should be able to access localhost:5001 on your browser"
  49. echo "login using admin/admin"
  50. echo "---------------------------------------------------"
  51. if ! docker run -p 5001:8088 apache-superset:${SUPERSET_VERSION_RC}; then
  52. echo "---------------------------------------------------"
  53. echo "[ERROR] Seems like this apache-superset:${SUPERSET_VERSION_RC} has a setup/startup problem!"
  54. echo "---------------------------------------------------"
  55. fi