From ca34ea04866b91653bc6494afce3a12be6657b7c Mon Sep 17 00:00:00 2001 From: solidnerd Date: Sat, 26 Dec 2020 12:35:03 +0100 Subject: [PATCH] fix: GITLAB_RELATIVE_URL_ROOT installation method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit During the last remove of the node_modules folder it wasn’t possbile to recompile assets on the start of the container. This is neccesarry for the GITLAB_RELATIVE_URL_ROOT to work correctly. Signed-off-by: solidnerd --- Dockerfile | 2 +- assets/runtime/functions | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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