develop.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash
  2. # Copyright 2017 Google Inc. All Rights Reserved.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # ==============================================================================
  16. # This file starts up a development server, using webpack in development mode.
  17. # It takes no arguments. See README.md for more information.
  18. viz_path="$(readlink -f "$(dirname "$0")")"
  19. (
  20. cd "${viz_path}"
  21. docker build -t dragnn-viz-dev .
  22. )
  23. # Apparently the Webpack dev server doesn't die properly when it gets a sigint.
  24. # So we daemonize it, follow logs, listen for SIGINT, and kill it manually.
  25. set -e
  26. docker run -d --name dragnn-viz-dev \
  27. -v "${viz_path}:/code/src" \
  28. -p 127.0.0.1:9000:9000 \
  29. dragnn-viz-dev
  30. trap "docker kill dragnn-viz-dev && docker rm dragnn-viz-dev" INT
  31. sleep 0.5 # Wait for the new container to start, so we don't echo old logs.
  32. docker logs --follow dragnn-viz-dev