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 = [
"cachetools", "requests", "ecmwf-api-client", "openpyxl"] # openpyxl is implicitly required by pandas.read_excel()
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",
"h5py": "conda install -c conda-forge h5py",
"numba": "conda install -c conda-forge numba",
......
......@@ -2,21 +2,21 @@
context_dir="./context"
dockerfile="sicor_ci.docker"
tag="sicor_ci:0.14.3"
gitlab_runner_prefix="sicor_gitlab_CI_runner"
tag="nb__sicor_ci:0.16.0"
gitlab_runner_prefix="sicor_ci_runner__v0.16.0__mefe2"
echo "Remove existing runners"
echo "Relevant containers:"
sudo docker ps --filter name=${gitlab_runner_prefix}
container=$(sudo docker ps -aq --filter name=${gitlab_runner_prefix})
docker ps --filter name=${gitlab_runner_prefix}
container=$(docker ps -aq --filter name=${gitlab_runner_prefix})
for cnt in ${container[@]};
do
read -p "Do you want to stop old container Container id:$cnt [y|n]?" quest_rm
if (( "${quest_rm}" == "y" ))
then
echo "Container id:$cnt -> stop ->su rm"
sudo docker stop $cnt
sudo docker rm $cnt
docker stop $cnt
docker rm $cnt
fi
done
......@@ -27,13 +27,12 @@ then
cd $context_dir
rm -rf sicor
rm -rf EnPT
read -p "Please enter gitlab username: " gl_un
git clone https://${gl_un}@git.gfz-potsdam.de/EnMAP/GFZ_Tools_EnMAP_BOX/EnPT.git
git clone https://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
cd ..
echo "#### Build runner docker image"
sudo docker rmi ${tag}
sudo docker build -f ${context_dir}/${dockerfile} -m 20G -t ${tag} ${context_dir} &> docker_build.log
docker rmi ${tag}
docker build -f ${context_dir}/${dockerfile} -m 20G -t ${tag} ${context_dir} &> docker_build.log
fi
read -p "How many runners shall be created? Enter number:" n_runners
......@@ -42,7 +41,7 @@ for ((i=1;i<=$n_runners;i++));
do
gitlab_runner="${gitlab_runner_prefix}_$(date '+%Y%m%d_%H%M%S')"
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
echo "#### Register container at gitlab, get token here https://git.gfz-potsdam.de/EnMAP/sicor/settings/ci_cd"
......@@ -56,12 +55,14 @@ do
fi
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' \
--registration-token '${token}' \
--run-untagged=true \
--locked=true \
--tag-list sicor_ci_client \
--description '${runner_name}_${i}' \
--docker-image '${tag}' "
--docker-image '${tag}' \
--access-level='not_protected' \
--docker-pull-policy='never' "
done
......@@ -6,7 +6,7 @@ channels: &id1
dependencies:
- python=3.*.*
- numpy
- gdal
- gdal<=3.1.2
- scikit-image
- pyproj
- lxml
......
......@@ -6,7 +6,7 @@ channels: &id1
dependencies:
- python=3.*.*
- numpy
- gdal
- gdal<=3.1.2
- scikit-image
- pyproj
- lxml
......@@ -16,6 +16,7 @@ dependencies:
- h5py
- numba
- scikit-learn<=0.24.0
- pygrib
- pip:
- dicttoxml
......
......@@ -22,12 +22,14 @@ RUN /bin/bash -i -c "source /root/miniconda3/bin/activate ; \
# update the sicor_env environment
RUN /bin/bash -i -c "\
source /root/miniconda3/bin/activate ; \
source activate sicor_env; \
conda env update -n sicor_env -f /root/environment_sicor_latest.yml"
conda install -c conda-forge mamba ; \
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 /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 /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