diff --git a/.docker/opt/configure-aiida.sh b/.docker/opt/configure-aiida.sh index d189ce57ac..eb37bda560 100755 --- a/.docker/opt/configure-aiida.sh +++ b/.docker/opt/configure-aiida.sh @@ -6,11 +6,26 @@ set -x # Environment. -reentry scan export SHELL=/bin/bash +# Activate conda. +__conda_setup="$('/opt/conda/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" +if [ $? -eq 0 ]; then + eval "$__conda_setup" +else + if [ -f "/opt/conda/etc/profile.d/conda.sh" ]; then + . "/opt/conda/etc/profile.d/conda.sh" + else + export PATH="/opt/conda/bin:$PATH" + fi +fi +unset __conda_setup + +# Very important to run after conda activation, otherwise AiiDA won't work. +reentry scan + # Setup AiiDA autocompletion. -grep _VERDI_COMPLETE .bash_profile &> /dev/null || echo 'eval "$(_VERDI_COMPLETE=source verdi)"' >> /home/$SYSTEM_USER/.bashrc +grep _VERDI_COMPLETE /home/$SYSTEM_USER/.bashrc &> /dev/null || echo 'eval "$(_VERDI_COMPLETE=source verdi)"' >> /home/$SYSTEM_USER/.bashrc # Check if user requested to set up AiiDA profile (and if it exists already) if [[ $SETUP_DEFAULT_PROFILE == true ]] && ! verdi profile show $PROFILE_NAME &> /dev/null; then @@ -57,4 +72,4 @@ verdi profile show || echo "The default profile is not set." verdi database migrate --force || echo "Database migration failed." # Daemon will start only if the database exists and is migrated to the latest version. -verdi daemon start || echo "AiiDA daemon is not running." \ No newline at end of file +verdi daemon start || echo "AiiDA daemon is not running." diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8203615748..7746a8bae7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -176,14 +176,14 @@ jobs: sudo apt-get update sudo apt-get install docker-ce - - name: Build the aiida-core image and run it - run: | + - name: Build the aiida-core image + run: docker build -t aiida-core . - docker run -d aiida-core - - name: Check that default AiiDA profile was set up + - name: Run aiida-core image and test the default aiida profile and localhost computer. run: | - export DOCKERID=`docker ps -qf 'ancestor=aiida-core'` + export DOCKERID=`docker run -d aiida-core` docker exec --tty $DOCKERID wait-for-services + docker logs $DOCKERID docker exec --tty --user aiida $DOCKERID /bin/bash -l -c 'verdi profile show default' docker exec --tty --user aiida $DOCKERID /bin/bash -l -c 'verdi computer show localhost' diff --git a/Dockerfile b/Dockerfile index a682ab7ba3..96eecfcb0c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,5 +21,3 @@ COPY .docker/my_init.d/configure-aiida.sh /etc/my_init.d/40_configure-aiida.sh # Use phusion baseimage docker init system. CMD ["/sbin/my_init"] - -#EOF