diff --git a/Dockerfile b/Dockerfile index fc64c119..5279f6e1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -79,7 +79,7 @@ LABEL \ EXPOSE 22/tcp 80/tcp 443/tcp -VOLUME ["${GITLAB_DATA_DIR}", "${GITLAB_LOG_DIR}"] +VOLUME ["${GITLAB_DATA_DIR}", "${GITLAB_LOG_DIR}","${GITLAB_HOME}/gitlab/node_modules"] WORKDIR ${GITLAB_INSTALL_DIR} ENTRYPOINT ["/sbin/entrypoint.sh"] CMD ["app:start"] diff --git a/assets/runtime/functions b/assets/runtime/functions index 663d26b4..6eb19ecf 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -1806,6 +1806,14 @@ migrate_database() { if [[ ! -f ${GITLAB_TEMP_DIR}/GITLAB_RELATIVE_URL_ROOT || ${GITLAB_RELATIVE_URL_ROOT} != ${CACHE_GITLAB_RELATIVE_URL_ROOT} ]]; then # assets need to be recompiled when GITLAB_RELATIVE_URL_ROOT is used if [[ -n ${GITLAB_RELATIVE_URL_ROOT} ]]; then + if [[ ! -d ${GITLAB_HOME}/gitlab/node_modules ]]; then + mkdir -p ${GITLAB_HOME}/gitlab/node_modules + chown -R ${GITLAB_USER}: ${GITLAB_HOME}/gitlab/node_modules + fi + echo "Prepare recomplie assets... Installing missing node_modules for assets" + chown -R ${GITLAB_USER}: ${GITLAB_HOME}/gitlab/node_modules + exec_as_git yarn install --production --pure-lockfile + exec_as_git yarn add ajv@^4.0.0 echo "Recompiling assets (relative_url in use), this could take a while..." exec_as_git bundle exec rake gitlab:assets:compile NODE_OPTIONS="--max-old-space-size=4096" >/dev/null 2>&1 fi