From ef49620838d9fc5d96e304b6f30879b2c9107bfe Mon Sep 17 00:00:00 2001 From: Jusong Yu Date: Fri, 20 Sep 2024 14:15:24 +0200 Subject: [PATCH] use flag file .FLAG_HOME_INITIALIZED --- Dockerfile | 3 +-- before-notebook.d/00_untar-home.sh | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 512a05c88..6016d1aee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -80,10 +80,9 @@ RUN --mount=from=qe_conda_env,source=${QE_DIR},target=${QE_DIR} \ bash /usr/local/bin/before-notebook.d/42_setup-hq-computer.sh && \ python -m aiidalab_qe install-qe --computer ${HQ_COMPUTER} && \ python -m aiidalab_qe install-pseudos --source ${PSEUDO_FOLDER} && \ - touch /home/${NB_USER}/work/.placeholder && \ verdi daemon stop && \ mamba run -n aiida-core-services pg_ctl stop && \ - # touch /home/${NB_USER}/.FLAG_HOME_INITIALIZED && \ + touch /home/${NB_USER}/.FLAG_HOME_INITIALIZED && \ cd /home/${NB_USER} && tar -cf /opt/conda/home.tar . # STAGE 3 - Final stage diff --git a/before-notebook.d/00_untar-home.sh b/before-notebook.d/00_untar-home.sh index a900c28ca..c37c5ab66 100644 --- a/before-notebook.d/00_untar-home.sh +++ b/before-notebook.d/00_untar-home.sh @@ -4,7 +4,7 @@ set -eux home="/home/${NB_USER}" # Untar home archive file to restore home directory if it is empty -if [[ $(ls -A ${home} | wc -l) -le 1 ]]; then +if [ ! -e $home/.FLAG_HOME_INITIALIZED ]; then if [[ ! -f $HOME_TAR ]]; then echo "File $HOME_TAR does not exist!" exit 1 @@ -15,6 +15,9 @@ if [[ $(ls -A ${home} | wc -l) -le 1 ]]; then fi echo "Extracting $HOME_TAR to $home" + # NOTE: a tar error when deployed to k8s but at the momment not cause any issue + # tar: .: Cannot utime: Operation not permitted + # tar: .: Cannot change mode to rwxr-s---: Operation not permitted tar -xf $HOME_TAR -C "$home" else echo "$home folder is not empty!"