Commit 038f236d4060d6f68c0e41f8e8722c84cfe70cec
1 parent
6692316e
Exists in
dev
cleanup
Showing
1 changed file
with
14 additions
and
26 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 | +docker_folder=$(pwd 2>&1) | |
5 | 5 | |
6 | +# PRE-CONDITION : pyros container must be running | |
7 | +# If no container is running Start it | |
8 | +if ! [ $(docker ps | grep 'pyros' | wc -l) -eq 4 ] ; then | |
9 | + echo "pyros-db or pyros weren't running, starting them..." | |
10 | + ./PYROS_DOCKER_START | |
11 | + #./PYROS_DOCKER_START.bat | |
12 | +fi | |
13 | + | |
14 | +# Main function git pull & rebuild if necessary | |
6 | 15 | already_uptodate="Déjà à jour." |
7 | 16 | check_files=("docker-compose.yml" "Dockerfile" "install/requirements.in" "install/requirements.txt" "doc_rst/requirements.in" "doc_rst/requirements.txt") |
8 | 17 | check_files="${check_files[@]}" |
... | ... | @@ -20,7 +29,6 @@ function git_pull { |
20 | 29 | echo $gitpull_output |
21 | 30 | # test only |
22 | 31 | #gitpull_output=$gitpull_output."Dockerfile " |
23 | - #gitpull_output=$gitpull_output."doc_rst/requirements.txt " | |
24 | 32 | # Check if exists file changed that requires rebuild |
25 | 33 | #for file in "${check_files[@]}" |
26 | 34 | for f in $check_files ; do |
... | ... | @@ -30,10 +38,8 @@ function git_pull { |
30 | 38 | 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 | 39 | echo "=> Build & start again the PyROS image ? ([y]/n)" |
32 | 40 | read input ; [ -z ${input} ] && input="y" |
33 | - #echo $answer | |
34 | 41 | [ $input != "y" ] && exit 1 |
35 | - #echo $root_folder | |
36 | - (cd $root_folder && ./PYROS_DOCKER_BUILD && ./PYROS_DOCKER_START) | |
42 | + (cd $docker_folder && ./PYROS_DOCKER_BUILD && ./PYROS_DOCKER_START) | |
37 | 43 | # BUILF only once !!! |
38 | 44 | break |
39 | 45 | fi |
... | ... | @@ -42,41 +48,22 @@ function git_pull { |
42 | 48 | } |
43 | 49 | |
44 | 50 | |
45 | -# PRE-CONDITION : pyros container must be running | |
46 | -# If no container is running Start it | |
47 | -if ! [ $(docker ps | grep 'pyros' | wc -l) -eq 4 ] ; then | |
48 | - echo "pyros-db or pyros weren't running, starting them..." | |
49 | - ./PYROS_DOCKER_START | |
50 | - #./PYROS_DOCKER_START.bat | |
51 | -fi | |
52 | - | |
53 | 51 | # I - Update Guitastro |
54 | 52 | echo |
55 | 53 | echo "**********************************" |
56 | 54 | echo "I - Updating Guitastro source code" |
57 | 55 | echo "**********************************" |
58 | 56 | echo |
59 | -# Go to GuitAstro/ folder | |
60 | 57 | git_pull ../vendor/guitastro/ |
61 | -#check_files=("docker-compose.yml" "Dockerfile" "install/requirements.in") | |
62 | -#git_pull ../vendor/guitastro/ ${check_files[@]} | |
63 | 58 | |
64 | 59 | |
65 | 60 | # II - Update PyROS |
66 | -#cd $root_folder | |
67 | 61 | echo |
68 | 62 | echo "**********************************" |
69 | 63 | echo "II - Updating PyROS source code" |
70 | 64 | echo "**********************************" |
71 | 65 | echo |
72 | -# Go to PYROS/ folder | |
73 | 66 | git_pull ../ |
74 | -# Check if exists file changed that requires rebuild | |
75 | -#check_files=("docker-compose.yml" "Dockerfile" "install/requirements.in") | |
76 | - | |
77 | - | |
78 | -# TODO : test if git pull worked and if git pull changed dockerfile, requirements.in, docker-compose.yml | |
79 | -# Tell user to rebuild | |
80 | 67 | |
81 | 68 | |
82 | 69 | # III - Update all observatories with git repo |
... | ... | @@ -91,10 +78,11 @@ for dir in * ; do |
91 | 78 | if [ -d $dir/.git ] ; then |
92 | 79 | echo "Updating observatory $dir source code" |
93 | 80 | git_pull $dir |
94 | - #cd ../ | |
95 | 81 | fi |
96 | 82 | done |
97 | -cd ../PYROS/docker/ | |
83 | +#cd ../PYROS/docker/ | |
84 | +cd $docker_folder | |
85 | + | |
98 | 86 | |
99 | 87 | # IV - pyros.py update => update BD + doc |
100 | 88 | echo | ... | ... |