Commit 6692316ed73d9e0ac61f68add655a51c51f73eef
1 parent
156992e1
Exists in
dev
BUILD auto in PYROS_DOCKER_UPDATE if any docker file changed
Showing
1 changed file
with
17 additions
and
6 deletions
Show diff stats
docker/PYROS_DOCKER_UPDATE
1 | #!/usr/bin/env bash | 1 | #!/usr/bin/env bash |
2 | 2 | ||
3 | # In docker/ folder | 3 | # In docker/ folder |
4 | -#root_folder=$(pwd 2>&1) | 4 | +root_folder=$(pwd 2>&1) |
5 | 5 | ||
6 | already_uptodate="Déjà à jour." | 6 | already_uptodate="Déjà à jour." |
7 | -check_files=("docker-compose.yml" "Dockerfile" "install/requirements.in") | 7 | +check_files=("docker-compose.yml" "Dockerfile" "install/requirements.in" "install/requirements.txt" "doc_rst/requirements.in" "doc_rst/requirements.txt") |
8 | check_files="${check_files[@]}" | 8 | check_files="${check_files[@]}" |
9 | function git_pull { | 9 | function git_pull { |
10 | dir=$1 | 10 | dir=$1 |
@@ -12,19 +12,30 @@ function git_pull { | @@ -12,19 +12,30 @@ function git_pull { | ||
12 | cd $dir | 12 | cd $dir |
13 | gitpull_output=$(git pull 2>&1) | 13 | gitpull_output=$(git pull 2>&1) |
14 | # IF git pull error (other than $already_uptodate) => stop | 14 | # IF git pull error (other than $already_uptodate) => stop |
15 | - if [[ $? -eq 1 && "$gitpull_output"!="$already_uptodate" ]]; then | 15 | + if [[ $? -eq 1 && "$gitpull_output" != "$already_uptodate" ]]; then |
16 | echo "Git pull failed. Error message is:" | 16 | echo "Git pull failed. Error message is:" |
17 | echo $gitpull_output | 17 | echo $gitpull_output |
18 | exit 1 | 18 | exit 1 |
19 | fi | 19 | fi |
20 | echo $gitpull_output | 20 | echo $gitpull_output |
21 | + # test only | ||
22 | + #gitpull_output=$gitpull_output."Dockerfile " | ||
23 | + #gitpull_output=$gitpull_output."doc_rst/requirements.txt " | ||
21 | # Check if exists file changed that requires rebuild | 24 | # Check if exists file changed that requires rebuild |
22 | #for file in "${check_files[@]}" | 25 | #for file in "${check_files[@]}" |
23 | for f in $check_files ; do | 26 | for f in $check_files ; do |
24 | #echo "check $f" | 27 | #echo "check $f" |
25 | - if grep -q "$f" <<< "$gitpull_output"; then | ||
26 | - echo "WARNING : One of docker related files has been changed. You should build again the PyROS Image" | ||
27 | - return 1 | 28 | + #if [ $f == "doc_rst/requirements.txt" ] ; then |
29 | + if grep -q "$f" <<< "$gitpull_output" ; then | ||
30 | + echo "WARNING : One of docker related files ($f) has been changed. You should build again the PyROS Image before going on with the UPDATE..." | ||
31 | + echo "=> Build & start again the PyROS image ? ([y]/n)" | ||
32 | + read input ; [ -z ${input} ] && input="y" | ||
33 | + #echo $answer | ||
34 | + [ $input != "y" ] && exit 1 | ||
35 | + #echo $root_folder | ||
36 | + (cd $root_folder && ./PYROS_DOCKER_BUILD && ./PYROS_DOCKER_START) | ||
37 | + # BUILF only once !!! | ||
38 | + break | ||
28 | fi | 39 | fi |
29 | done | 40 | done |
30 | cd - > /dev/null | 41 | cd - > /dev/null |