From eb5b80075939d8167b175d67075ee5c623d63d01 Mon Sep 17 00:00:00 2001 From: tuutti Date: Thu, 12 Dec 2024 10:12:55 +0200 Subject: [PATCH] Fixed drush in CI --- local/drupal/Dockerfile | 5 ++++- local/drupal/files/usr/local/bin/drush | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 local/drupal/files/usr/local/bin/drush diff --git a/local/drupal/Dockerfile b/local/drupal/Dockerfile index c7f9b82..84b87ed 100644 --- a/local/drupal/Dockerfile +++ b/local/drupal/Dockerfile @@ -18,7 +18,10 @@ RUN apk add --no-cache \ gnupg COPY entrypoints/ /entrypoints -RUN chmod +x /entrypoints/* +COPY files/usr /usr +RUN chmod +x /entrypoints/* \ + # Drush binary is needed in CI. + /usr/local/bin/drush COPY files/etc/nginx /etc/nginx diff --git a/local/drupal/files/usr/local/bin/drush b/local/drupal/files/usr/local/bin/drush new file mode 100644 index 0000000..aac092d --- /dev/null +++ b/local/drupal/files/usr/local/bin/drush @@ -0,0 +1,18 @@ +#!/bin/sh + +# Start at the current directory +dir=$PWD + +# While not at the root (/) +while [[ "$dir" != "/" ]]; do + # If vendor/bin/drush exists, run it + if [[ -x "$dir/vendor/bin/drush" ]]; then + "$dir/vendor/bin/drush" "$@" + exit $? + fi + # Go up one directory level + dir=$(dirname "$dir") +done + +echo "Could not find drush in any parent directory." +exit 1