summaryrefslogtreecommitdiff
path: root/util/docker-init.sh
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-01-12 18:55:26 +0100
committerYorhel <git@yorhel.nl>2020-01-12 18:55:28 +0100
commit5b39f0d84bd58f75185b4901cf03fdbf55c73b62 (patch)
tree1a4e91258b92bcb7a5e47bdee38795ea5a5ccc42 /util/docker-init.sh
parent5fd5479be1b72b5ebcdf44d320c64ac3f61b70a7 (diff)
Docker: Add image version check to docker-init.sh
This adds a method to signal that the docker image should be rebuilt after a change or update to the dependencies - which is much better than getting weird hard-to-debug errors because an older version of TUWF happens to be missing a function or something.
Diffstat (limited to 'util/docker-init.sh')
-rwxr-xr-xutil/docker-init.sh15
1 files changed, 12 insertions, 3 deletions
diff --git a/util/docker-init.sh b/util/docker-init.sh
index 7555fe51..4e34f753 100755
--- a/util/docker-init.sh
+++ b/util/docker-init.sh
@@ -1,8 +1,17 @@
#!/bin/sh
-if ! test -f /var/vndb-docker-image; then
- echo "This script should only be run from within the VNDB docker container."
- echo "Check the README for instructions."
+VER=`test -f /var/www/Dockerfile && grep VNDB_DOCKER_VERSION= /var/www/Dockerfile | sed -E s/^.+=//`
+
+if [ -z "$VER" -o -z "$VNDB_DOCKER_VERSION" -o "$VER" != "$VNDB_DOCKER_VERSION" ]; then
+ echo "The Docker image version ($VNDB_DOCKER_VERSION) does not match the version in the currently checked out source code ($VER)."
+ echo
+ echo "Please rebuild the Docker image and try again:"
+ echo
+ echo " docker rmi vndb"
+ echo " docker build -t vndb ."
+ echo
+ echo "Check README.md for instructions."
+ echo
exit 1
fi