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 | 1 | #!/usr/bin/env bash |
2 | 2 | |
3 | 3 | # In docker/ folder |
4 | -#root_folder=$(pwd 2>&1) | |
4 | +root_folder=$(pwd 2>&1) | |
5 | 5 | |
6 | 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 | 8 | check_files="${check_files[@]}" |
9 | 9 | function git_pull { |
10 | 10 | dir=$1 |
... | ... | @@ -12,19 +12,30 @@ function git_pull { |
12 | 12 | cd $dir |
13 | 13 | gitpull_output=$(git pull 2>&1) |
14 | 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 | 16 | echo "Git pull failed. Error message is:" |
17 | 17 | echo $gitpull_output |
18 | 18 | exit 1 |
19 | 19 | fi |
20 | 20 | echo $gitpull_output |
21 | + # test only | |
22 | + #gitpull_output=$gitpull_output."Dockerfile " | |
23 | + #gitpull_output=$gitpull_output."doc_rst/requirements.txt " | |
21 | 24 | # Check if exists file changed that requires rebuild |
22 | 25 | #for file in "${check_files[@]}" |
23 | 26 | for f in $check_files ; do |
24 | 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 | 39 | fi |
29 | 40 | done |
30 | 41 | cd - > /dev/null | ... | ... |