Commit 1c482dfe authored by Hannes Diedrich's avatar Hannes Diedrich
Browse files

Finalized docker.

parent e86606fb
Pipeline #1785 canceled with stages
......@@ -2,35 +2,44 @@
context_dir="./context"
dockerfile="gts2_client.docker"
runner_tag="centos:gts2_client_runner"
runner_os="centos"
runner_iname="gts2_client_runner"
runner_tag="${runner_os}:${runner_iname}"
container_name="gts2_client"
cred_file="$HOME/credentials_gts2_client"
out_data_folder="/tmp/gts2_client"
# Copying credentials file into context dir, if exists
if [ -e ${cred_file} ]
#Check if image exists
if [ $(sudo docker images | grep ${runner_iname} | wc -l) == 0 ]
then
echo "cp ${cred_file} ./context/"
cp ${cred_file} ./context/
else
echo "read"
read -p "Please enter GTS2 username: " username
read -p "Please enter GTS2 password: " password
read -p "Please enter GTS2 port (default 80): " port
cat > ${cred_file} <<EOL
{
"user": "${username}",
"password": "${password}",
"port": ${port}
}
# Copying credentials file into context dir, if exists
if [ -e ${cred_file} ]
then
echo "cp ${cred_file} ./context/"
cp ${cred_file} ./context/
else
echo "read"
read -p "Please enter GTS2 username: " username
read -p "Please enter GTS2 password: " password
read -p "Please enter GTS2 port (default 80): " port
cat > ${cred_file} <<EOL
{
"user": "${username}",
"password": "${password}",
"port": ${port}
}
EOL
fi
fi
# build docker image
sudo docker build -f ${context_dir}/${dockerfile} -m 20G -t ${runner_tag} ${context_dir}
# build docker image
sudo docker build -f ${context_dir}/${dockerfile} -m 20G -t ${runner_tag} ${context_dir}
fi
#run container and start a shell where you can run the gts2_client
sudo docker rm -f $container_name
mkdir -p $out_data_folder
sudo docker run -it --name $container_name -v $out_data_folder:$out_data_folder $runner_tag \
sudo docker rm -f ${container_name}
mkdir -p ${out_data_folder}
echo "Starting gts2_container, please write files to ${out_data_folder} (setting the -o option of client accordingly)"
sudo docker run -it --name ${container_name} -v ${out_data_folder}:${out_data_folder} ${runner_tag} \
bash -i -c "cd /home/gts2_client; git pull origin master; python setup.py install; source ~/anaconda3/bin/activate; python setup.py install; bash"
\ No newline at end of file
Supports Markdown
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