postBuild 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/bin/bash
  2. #
  3. # Copyright 2018-2022 Elyra 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. set -euo pipefail
  18. node --version
  19. npm --version
  20. mkdir -p ~/.npm-global
  21. npm config set scripts-prepend-node-path auto
  22. npm config set prefix ~/.npm-global
  23. export PATH=$(pwd)/.npm-global/bin/:$PATH
  24. # Download and install Yarn Package Manager using npm
  25. npm install -g yarn
  26. # Build Elyra Distribution
  27. make release
  28. # Updage dependencies and install Elyra wheel
  29. pip install --upgrade pip
  30. pip install --upgrade tornado jupyter-core jupyter-server jupyterlab dist/*.whl
  31. mkdir -p binder-demo
  32. # Enable debug output
  33. set -x
  34. # repo2docker clones the Elyra repository before the Docker image is built
  35. # and uses the cloned directory as "root". The git extension recognizes that
  36. # the directory is git-enabled and therefore prevents the user from
  37. # cloning other repositories using the UI. Remove the git artifacts in the
  38. # root directory to work around this issue.
  39. rm -rf ~/.git*
  40. # Add getting started assets to Docker image
  41. # (1) Clone the examples repository.
  42. git clone https://github.com/elyra-ai/examples.git
  43. EXAMPLES_BASE_DIR=examples
  44. # (2) Copy all getting started assets to the working directory,
  45. # which is referenced when binder is invoked, e.g.
  46. # https://mybinder.org/v2/gh/elyra-ai/elyra/main?urlpath=lab/tree/binder-demo
  47. cp -r $EXAMPLES_BASE_DIR/binder/getting-started/* binder-demo/
  48. # (3) Remove the code snippets from the working directory.
  49. # They need to reside in a different location to be usable.
  50. rm -rf binder-demo/code-snippets
  51. # (4) Add code snippet files to the appropriate location
  52. DATA_DIR=`jupyter --data-dir`
  53. CODE_SNIPPETS_DIR="$DATA_DIR/metadata/code-snippets/"
  54. mkdir -p $CODE_SNIPPETS_DIR
  55. cp $EXAMPLES_BASE_DIR/binder/getting-started/code-snippets/*.json $CODE_SNIPPETS_DIR
  56. # (5) Remove cloned examples directory
  57. rm -rf $EXAMPLES_BASE_DIR