From f1e8b5be05730e1168952801f6ea4cafcb34a135 Mon Sep 17 00:00:00 2001 From: EvertBunschoten Date: Thu, 18 Jul 2024 11:23:18 +0200 Subject: [PATCH] Added bash file which installs necessary packages onto docker container --- docker/build/getPINNTraining.sh | 56 +++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 docker/build/getPINNTraining.sh diff --git a/docker/build/getPINNTraining.sh b/docker/build/getPINNTraining.sh new file mode 100644 index 0000000..fd479ea --- /dev/null +++ b/docker/build/getPINNTraining.sh @@ -0,0 +1,56 @@ + +echo "PINNTraining Docker Container" +usage="$(basename "$0") [-h] [-b branch_name] +where: + -h show this help text + -b branch name (if not given, existing PINNTraining directory must be mounted in /src/PINNTraining). + +Compiled binaries can be found at /install/. Mount that directory for access. +Note: If you specify a working directory using the --workdir option for docker, + append this directory to all paths above (e.g. use --workdir=/tmp if running in user mode)." + +flags="" +branch="" +workdir=$PWD + +export CCACHE_DIR=$workdir/ccache + +if [ "$#" -ne 0 ]; then + while [ "$(echo $1 | cut -c1)" = "-" ] + do + case "$1" in + ;; + -b) + branch=$2 + shift 2 + ;; + *) + echo "$usage" >&2 + exit 1 + ;; + esac + done +fi + + +if [ ! -z "$branch" ]; then + name="PINNTraining_$(echo $branch | sed 's/\//_/g')" + echo "Branch provided. Cloning to $PWD/src/$name" + if [ ! -d "src" ]; then + mkdir "src" + fi + cd "src" + git clone --recursive https://github.com/EvertBunschoten/PINNTraining $name + cd $name + git config --add remote.origin.fetch '+refs/pull/*/merge:refs/remotes/origin/refs/pull/*/merge' + git config --add remote.origin.fetch '+refs/heads/*:refs/remotes/origin/refs/heads/*' + git fetch origin + git checkout $branch + git submodule update +else + if [ ! -d "src/PINNTraining" ]; then + echo "PINNTraining source directory not found. Make sure to mount existing PINNTraining at directory at /src/PINNTraining. Otherwise use -b to provide a branch." + exit 1 + fi + cd src/PINNTraining +fi \ No newline at end of file