diff --git a/Dockerfile b/Dockerfile index 1a8573c34e..38a626c132 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,12 +28,12 @@ RUN chown -R invenio:invenio ${WORKING_DIR} USER 1000 -# Set last GIT commit hash. Example: -# docker build --build-arg GIT_HASH=$(git rev-parse @) . ARG GIT_HASH -# Last GIT commit hash ENV INVENIO_RERO_ILS_APP_GIT_HASH ${GIT_HASH:-''} +ARG GIT_UI_HASH +ENV INVENIO_RERO_ILS_UI_GIT_HASH ${GIT_UI_HASH:-''} +ARG UI_TGZ="" ENV INVENIO_COLLECT_STORAGE='flask_collect.storage.file' -RUN ./scripts/bootstrap --deploy && rm -fr ui/node_modules +RUN ./scripts/bootstrap --deploy ${UI_TGZ} && rm -fr ui/node_modules diff --git a/rero_ils/config.py b/rero_ils/config.py index 7b969f9144..cfa013a546 100644 --- a/rero_ils/config.py +++ b/rero_ils/config.py @@ -1039,8 +1039,12 @@ def _(x): RERO_ILS_PERMALINK_RERO_URL = 'http://data.rero.ch/01-{identifier}' RERO_ILS_PERMALINK_BNF_URL = 'http://catalogue.bnf.fr/ark:/12148/{identifier}' -#: Git commit hash. If set, a link to github commit page is displayed on RERO-ILS frontpage. +#: Git commit hash. If set, a link to github commit page +#: is displayed on RERO-ILS frontpage. RERO_ILS_APP_GIT_HASH = None +#: rero-ils-ui Git commit hash. If set, a link to github commit +#: page is displayed on RERO-ILS frontpage. +RERO_ILS_UI_GIT_HASH = None #: RERO_ILS MEF specific configurations. RERO_ILS_MEF_URL = 'https://{host}/api/mef/'.format(host='mef.rero.ch') diff --git a/rero_ils/templates/rero_ils/frontpage.html b/rero_ils/templates/rero_ils/frontpage.html index 8f690b53a3..da2296b3f9 100644 --- a/rero_ils/templates/rero_ils/frontpage.html +++ b/rero_ils/templates/rero_ils/frontpage.html @@ -82,12 +82,19 @@

Il progetto

{{_('Software source code')}} - {{_('on GitHub')}}, {{ _('version') }} + {{_('on GitHub')}} {% if config.RERO_ILS_APP_GIT_HASH %} +
rero-ils {{ _('version') }} {{ config.RERO_ILS_APP_GIT_HASH[:8] }} {% else %} +
{{ _('version') }} {{ version }} {% endif %} + {% if config.RERO_ILS_UI_GIT_HASH %} +
rero-ils-ui {{ _('version') }} + {{ config.RERO_ILS_UI_GIT_HASH[:8] }} + {% endif %} +

diff --git a/scripts/bootstrap b/scripts/bootstrap index 99f510c643..aee17176f3 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -69,7 +69,7 @@ flags=() deploy=false cmd="pipenv sync" ci=false -TGZ_PATH="" +tgz_file="" while test $# -gt 0 do case "$1" in @@ -79,14 +79,12 @@ do -c|--ci) # We are probably inside travis, check for env variables ci=true ;; - -t|--tgz_path) - TGZ_PATH=$2 - if [ -z $2 ] - then - error_msg+exit "Please give path to .tgz" - else - TGZ_PATH=$2 - fi ;; + -t|--tgz_package) + tgz_file=$2 + if [ ! -f ${tgz_file} ] + then + error_msg+exit "package tgz file dos not exist: ${tgz_file}" + fi ;; (--) shift; break;; (-*) flags+=("$1") ;; (*) break;; @@ -132,10 +130,10 @@ info_msg "Search static folder location" static_folder=$(pipenv run invenio shell --no-term-title -c "print('static_folder:%s' % app.static_folder)"|grep static_folder| cut -d: -f2-) info_msg "Install static folder npm dependencies in: ${static_folder}" pipenv run npm install --prefix "${static_folder}" -if [ ! -d $TGZ_PATH ] +if [ -f ${tgz_file} ] then - info_msg "Install RERO-ILS-UI from tgz" - pipenv run npm install "${TGZ_PATH}" --prefix "${static_folder}" + info_msg "Install RERO-ILS-UI from tgz: ${tgz_file}" + pipenv run npm install "${tgz_file}" --prefix "${static_folder}" fi # build the web assets