22
33services :
44 drupal :
5- image : drupal:${DRUPAL_VERSION:-10}-apache
5+ # image: drupal:${DRUPAL_VERSION:-10}-apache
6+ build :
7+ context : ../
8+ dockerfile_inline : |
9+ FROM drupal:${DRUPAL_VERSION:-10}-apache
10+
11+ COPY ./composer.json web/modules/${MODULE_NAME?}/
12+
13+ # https://github.com/docker-library/docs/blob/master/php/README.md#how-to-install-more-php-extensions
14+ RUN apt update && apt --yes install git libxml2-dev libxslt1-dev \
15+ && docker-php-ext-configure soap \
16+ && docker-php-ext-install soap \
17+ && docker-php-ext-configure xsl \
18+ && docker-php-ext-install xsl
19+
20+ # --------------------------------------------------------------------------------------------------------------------
21+ # We need to install dev requirements from our module, so we use
22+ # wikimedia/composer-merge-plugin to merge our module composer.json into
23+ # Drupal's.
24+ #
25+ # wikimedia/composer-merge-plugin is dead and has some issues
26+ # https://github.com/wikimedia/composer-merge-plugin/issues/159 »
27+ # https://github.com/wikimedia/composer-merge-plugin/pull/253
28+ RUN composer --no-plugins config allow-plugins true \
29+ && composer --no-plugins config minimum-stability dev \
30+ # Use --json to actually set a boolean value (rather that a string value, e.g. "true")
31+ && composer --no-plugins config extra.drupal-lenient.allow-all --json true \
32+
33+ # Configure wikimedia/composer-merge-plugin
34+ && composer --no-plugins config extra.merge-plugin.merge-extra --json true \
35+ && composer --no-plugins config extra.merge-plugin.merge-extra-deep --json true \
36+ && composer --no-plugins config extra.merge-plugin.include "web/modules/${MODULE_NAME?}/composer.json" \
37+ && composer require mglaman/composer-drupal-lenient wikimedia/composer-merge-plugin --with-all-dependencies
38+
39+ # Patch to make COMPOSER_IGNORE_PLATFORM_REQS=1 have effect
40+ # https://github.com/wikimedia/composer-merge-plugin/pull/253
41+ # RUN cd vendor/wikimedia/composer-merge-plugin/ && curl https://patch-diff.githubusercontent.com/raw/wikimedia/composer-merge-plugin/pull/253.diff | patch --strip=1
42+
43+ # Reset Drupal installation
44+ RUN find . -name .ht.sqlite -delete \
45+ && find web/sites/default -name -delete
46+
47+ # Install a minimal Drupal site.
48+ # https://www.drush.org/13.x/commands/site_install/
49+ RUN drush --yes site:install --db-url=sqlite://sites/default/files/.ht.sqlite?module=sqlite minimal -vvv
50+
651 ports :
752 - 80
853 volumes :
@@ -13,10 +58,10 @@ services:
1358 # volume (which is what we're creating here) will be initialized with the
1459 # existing content of the image at the same location
1560 - /var/www/html/sites
16- # Mount our code into the web/modules/contrib folder
17- - ../:/opt/drupal/web/modules/contrib /$MODULE_NAME
61+ # Mount our code into the web/modules folder
62+ - ../:/opt/drupal/web/sites/default/modules /$MODULE_NAME
1863 environment :
1964 # Let the module path, i.e. the mounted path, be known in the container
20- MODULE_PATH : web/modules/contrib /$MODULE_NAME
65+ MODULE_PATH : web/sites/default/modules /$MODULE_NAME
2166 # https://getcomposer.org/doc/03-cli.md#composer-ignore-platform-req-or-composer-ignore-platform-reqs
2267 COMPOSER_IGNORE_PLATFORM_REQS : 1
0 commit comments