diff --git a/docker-compose.build.yml b/docker-compose.build.yml new file mode 100644 index 00000000..36396853 --- /dev/null +++ b/docker-compose.build.yml @@ -0,0 +1,8 @@ +# This configuration does not include a processing node +# Which makes for faster setup times +version: '2' +services: + db: + build: ./db + webapp: + build: . diff --git a/docker-compose.yml b/docker-compose.yml index 4708c1b1..ecbac950 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,14 +8,14 @@ volumes: driver: local services: db: - build: ./db + image: pierotofy/webodm_db container_name: db ports: - "5432" volumes: - dbdata:/var/lib/postgresql/data webapp: - build: . + image: pierotofy/webodm_webapp container_name: webapp entrypoint: /bin/bash -c "chmod +x /webodm/*.sh && /bin/bash -c \"/webodm/wait-for-it.sh db:5432 -- /webodm/start.sh\"" volumes: diff --git a/webodm.sh b/webodm.sh index c968e10d..66f3756c 100755 --- a/webodm.sh +++ b/webodm.sh @@ -70,14 +70,15 @@ run(){ } start(){ - run "docker-compose -f docker-compose.yml -f docker-compose.nodeodm.yml up" + command="docker-compose -f docker-compose.yml -f docker-compose.nodeodm.yml" + run "$command up || $command start" } rebuild(){ - run "docker-compose down" + run "docker-compose down --remove-orphans" run "rm -fr node_modules/ || sudo rm -fr node_modules/" run "rm -fr nodeodm/external/node-OpenDroneMap || sudo rm -fr nodeodm/external/node-OpenDroneMap" - run "docker-compose build --no-cache" + run "docker-compose -f docker-compose.yml -f docker-compose.build.yml build --no-cache" #run "docker images --no-trunc -aqf \"dangling=true\" | xargs docker rmi" echo -e "\033[1mDone!\033[0m You can now start WebODM by running $0 start" } @@ -89,7 +90,7 @@ if [[ $1 = "start" ]]; then elif [[ $1 = "stop" ]]; then environment_check echo "Stopping WebODM..." - run "docker-compose down --remove-orphans" + run "docker-compose stop" elif [[ $1 = "rebuild" ]]; then environment_check echo "Rebuilding WebODM..." @@ -98,7 +99,10 @@ elif [[ $1 = "update" ]]; then echo "Updating WebODM..." run "git pull origin master" run "docker pull opendronemap/node-opendronemap" - rebuild + run "docker pull opendronemap/webodm_db" + run "docker pull opendronemap/webodm_webapp" + run "docker-compose down --remove-orphans" + echo -e "\033[1mDone!\033[0m You can now start WebODM by running $0 start" elif [[ $1 = "checkenv" ]]; then environment_check else