Browse Source

Allow docker scripts to be run from other directories

Ian Goldberg 6 months ago
parent
commit
b79daf99e9
2 changed files with 10 additions and 0 deletions
  1. 5 0
      build-docker
  2. 5 0
      set-networking

+ 5 - 0
build-docker

@@ -1,3 +1,8 @@
 #!/bin/bash
 
+# cd into the directory containing this script (from the bash faq 028)
+if [[ $BASH_SOURCE = */* ]]; then
+  cd -- "${BASH_SOURCE%/*}/" || exit
+fi
+
 docker build $* -t floram -f Dockerfile .

+ 5 - 0
set-networking

@@ -1,5 +1,10 @@
 #!/bin/bash
 
+# cd into the directory containing this script (from the bash faq 028)
+if [[ $BASH_SOURCE = */* ]]; then
+  cd -- "${BASH_SOURCE%/*}/" || exit
+fi
+
 latency=30ms
 bw=100mbit