Last active
August 22, 2018 00:07
-
-
Save scottrigby/c869ca5268c9b34ae7a2d0ba0c2bd4de to your computer and use it in GitHub Desktop.
bitnami-drupal-composer-persistence
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
. /opt/bitnami/base/functions | |
. /opt/bitnami/base/helpers | |
print_welcome_page | |
if [[ "$1" == "nami" && "$2" == "start" ]] || [[ "$1" == "/run.sh" ]]; then | |
. /init.sh | |
nami_initialize apache php mysql-client drupal | |
# Persist any changed composer dependencies. | |
# See: https://github.com/bitnami/bitnami-docker-drupal/issues/93 | |
OLD=/opt/bitnami/drupal | |
NEW=/bitnami/drupal | |
NAMES=(composer.json composer.lock vendor) | |
for NAME in ${NAMES[@]} | |
do | |
mv ${OLD}/${NAME} ${NEW}/ | |
ln -s ${NEW}/${NAME} ${OLD}/${NAME} | |
done | |
info "Created composer symlinks." | |
cd ${OLD} | |
# We need to rebuild the autoload files, because they contain relative links | |
# before moving the vendor directory. | |
# See: https://github.com/symfony/symfony/issues/18052 | |
composer update | |
info "Updated composer autoload file links." | |
# Drush fails with recursion when the vendor directory is symlinked. | |
# See: https://github.com/drush-ops/drush/pull/3110 | |
# See: https://github.com/drush-ops/drush/pull/3235 | |
# See: https://github.com/webflo/drupal-finder/issues/34 | |
# Instead, we remove drush from Drupal root vendor dir, install it a level up, | |
# and add the new location to PATH. | |
cd /opt/bitnami/drupal | |
composer remove drush/drush | |
cd /opt/bitnami | |
composer require drush/drush ^9.3 | |
# To-do: This does not work in bourne shell login (neither does adding to | |
# ~/.profile). Find a cross-shell compatible way to set this. | |
echo 'export PATH="/opt/bitnami/vendor/bin:$PATH"' >> ~/.bashrc | |
info "Starting drupal... " | |
fi | |
exec tini -- "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM bitnami/drupal:8 | |
COPY custom-app-entrypoint.sh / | |
ENTRYPOINT ["/custom-app-entrypoint.sh"] | |
CMD ["/run.sh"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See https://github.com/bitnami/bitnami-docker-drupal/issues/93