Commit 49c9c749 authored by Niklas Bohn's avatar Niklas Bohn
Browse files

Merge branch 'update_docker_image' into 'master'

Update docker image

See merge request !75
parents 67ad3514 080f1ba7
...@@ -35,7 +35,7 @@ requirements_save_to_install_with_setuptools = [ ...@@ -35,7 +35,7 @@ requirements_save_to_install_with_setuptools = [
"cachetools", "requests", "ecmwf-api-client", "openpyxl"] # openpyxl is implicitly required by pandas.read_excel() "cachetools", "requests", "ecmwf-api-client", "openpyxl"] # openpyxl is implicitly required by pandas.read_excel()
other_requirements = { # dict of "[needed import]: [proposed command for install] other_requirements = { # dict of "[needed import]: [proposed command for install]
"gdal": "conda install -c conda-forge gdal", "gdal": "conda install -c conda-forge gdal<=3.1.2",
"tables": "conda install -c conda-forge pytables", "tables": "conda install -c conda-forge pytables",
"h5py": "conda install -c conda-forge h5py", "h5py": "conda install -c conda-forge h5py",
"numba": "conda install -c conda-forge numba", "numba": "conda install -c conda-forge numba",
......
...@@ -2,21 +2,21 @@ ...@@ -2,21 +2,21 @@
context_dir="./context" context_dir="./context"
dockerfile="sicor_ci.docker" dockerfile="sicor_ci.docker"
tag="sicor_ci:0.14.3" tag="nb__sicor_ci:0.16.0"
gitlab_runner_prefix="sicor_gitlab_CI_runner" gitlab_runner_prefix="sicor_ci_runner__v0.16.0__mefe2"
echo "Remove existing runners" echo "Remove existing runners"
echo "Relevant containers:" echo "Relevant containers:"
sudo docker ps --filter name=${gitlab_runner_prefix} docker ps --filter name=${gitlab_runner_prefix}
container=$(sudo docker ps -aq --filter name=${gitlab_runner_prefix}) container=$(docker ps -aq --filter name=${gitlab_runner_prefix})
for cnt in ${container[@]}; for cnt in ${container[@]};
do do
read -p "Do you want to stop old container Container id:$cnt [y|n]?" quest_rm read -p "Do you want to stop old container Container id:$cnt [y|n]?" quest_rm
if (( "${quest_rm}" == "y" )) if (( "${quest_rm}" == "y" ))
then then
echo "Container id:$cnt -> stop ->su rm" echo "Container id:$cnt -> stop ->su rm"
sudo docker stop $cnt docker stop $cnt
sudo docker rm $cnt docker rm $cnt
fi fi
done done
...@@ -27,13 +27,12 @@ then ...@@ -27,13 +27,12 @@ then
cd $context_dir cd $context_dir
rm -rf sicor rm -rf sicor
rm -rf EnPT rm -rf EnPT
read -p "Please enter gitlab username: " gl_un git clone https://git.gfz-potsdam.de/EnMAP/GFZ_Tools_EnMAP_BOX/EnPT.git
git clone https://${gl_un}@git.gfz-potsdam.de/EnMAP/GFZ_Tools_EnMAP_BOX/EnPT.git
git clone https://git.gfz-potsdam.de/EnMAP/sicor.git --branch update_docker_image --single-branch sicor git clone https://git.gfz-potsdam.de/EnMAP/sicor.git --branch update_docker_image --single-branch sicor
cd .. cd ..
echo "#### Build runner docker image" echo "#### Build runner docker image"
sudo docker rmi ${tag} docker rmi ${tag}
sudo docker build -f ${context_dir}/${dockerfile} -m 20G -t ${tag} ${context_dir} &> docker_build.log docker build -f ${context_dir}/${dockerfile} -m 20G -t ${tag} ${context_dir} &> docker_build.log
fi fi
read -p "How many runners shall be created? Enter number:" n_runners read -p "How many runners shall be created? Enter number:" n_runners
...@@ -42,7 +41,7 @@ for ((i=1;i<=$n_runners;i++)); ...@@ -42,7 +41,7 @@ for ((i=1;i<=$n_runners;i++));
do do
gitlab_runner="${gitlab_runner_prefix}_$(date '+%Y%m%d_%H%M%S')" gitlab_runner="${gitlab_runner_prefix}_$(date '+%Y%m%d_%H%M%S')"
echo "#### Create gitlab-runner (daemon) container with tag; ${tag}" echo "#### Create gitlab-runner (daemon) container with tag; ${tag}"
sudo docker run -d --name ${gitlab_runner} --restart always \ docker run -d --name ${gitlab_runner} --restart always \
-v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:latest -v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:latest
echo "#### Register container at gitlab, get token here https://git.gfz-potsdam.de/EnMAP/sicor/settings/ci_cd" echo "#### Register container at gitlab, get token here https://git.gfz-potsdam.de/EnMAP/sicor/settings/ci_cd"
...@@ -56,12 +55,14 @@ do ...@@ -56,12 +55,14 @@ do
fi fi
echo "New gitlab runner image will named ${gitlab_runner}" echo "New gitlab runner image will named ${gitlab_runner}"
sudo docker exec -it ${gitlab_runner} /bin/bash -c "export RUNNER_EXECUTOR=docker && gitlab-ci-multi-runner register -n \ docker exec -it ${gitlab_runner} /bin/bash -c "export RUNNER_EXECUTOR=docker && gitlab-ci-multi-runner register -n \
--url 'https://git.gfz-potsdam.de/ci' \ --url 'https://git.gfz-potsdam.de/ci' \
--registration-token '${token}' \ --registration-token '${token}' \
--run-untagged=true \ --run-untagged=true \
--locked=true \ --locked=true \
--tag-list sicor_ci_client \ --tag-list sicor_ci_client \
--description '${runner_name}_${i}' \ --description '${runner_name}_${i}' \
--docker-image '${tag}' " --docker-image '${tag}' \
--access-level='not_protected' \
--docker-pull-policy='never' "
done done
...@@ -6,7 +6,7 @@ channels: &id1 ...@@ -6,7 +6,7 @@ channels: &id1
dependencies: dependencies:
- python=3.*.* - python=3.*.*
- numpy - numpy
- gdal - gdal<=3.1.2
- scikit-image - scikit-image
- pyproj - pyproj
- lxml - lxml
......
...@@ -6,7 +6,7 @@ channels: &id1 ...@@ -6,7 +6,7 @@ channels: &id1
dependencies: dependencies:
- python=3.*.* - python=3.*.*
- numpy - numpy
- gdal - gdal<=3.1.2
- scikit-image - scikit-image
- pyproj - pyproj
- lxml - lxml
...@@ -16,6 +16,7 @@ dependencies: ...@@ -16,6 +16,7 @@ dependencies:
- h5py - h5py
- numba - numba
- scikit-learn<=0.24.0 - scikit-learn<=0.24.0
- pygrib
- pip: - pip:
- dicttoxml - dicttoxml
......
...@@ -22,12 +22,14 @@ RUN /bin/bash -i -c "source /root/miniconda3/bin/activate ; \ ...@@ -22,12 +22,14 @@ RUN /bin/bash -i -c "source /root/miniconda3/bin/activate ; \
# update the sicor_env environment # update the sicor_env environment
RUN /bin/bash -i -c "\ RUN /bin/bash -i -c "\
source /root/miniconda3/bin/activate ; \ source /root/miniconda3/bin/activate ; \
source activate sicor_env; \ conda install -c conda-forge mamba ; \
conda env update -n sicor_env -f /root/environment_sicor_latest.yml" mamba update -n base -c conda-forge --all ; \
conda activate sicor_env ; \
mamba env update -n sicor_env -f /root/environment_sicor_latest.yml"
# copy EnPT to /root and install it # copy EnPT to /root and install it
COPY EnPT /root/EnPT COPY EnPT /root/EnPT
RUN /bin/bash -i -c "source /root/miniconda3/bin/activate ; source activate sicor_env ; cd /root/EnPT/ ; make install" RUN /bin/bash -i -c "source /root/miniconda3/bin/activate ; conda activate sicor_env ; cd /root/EnPT/ ; make install"
# copy SICOR to /root # copy SICOR to /root
COPY sicor /root/sicor COPY sicor /root/sicor
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment