Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 9.0, "buster" aliases, and use "drupal/recommended-project" layout #176

Merged
merged 5 commits into from Aug 6, 2020

Conversation

yosifkit
Copy link
Member

Fixes #169
Closes #175

The drupal/recommended-project is adjusted to use html/ instead of web/ so there is no effect to 8.8 and 8.9 except vendor (and composer.{json,lock}) moving to /var/www:

diff -U 4  <(docker run -i --rm drupal:8.9 sh -c 'pwd; ls -a; echo; echo '../'; ls -a ../') <(docker run -i --rm drupal:8.9-new sh -c 'pwd; ls -a; echo; echo '../'; ls -a ../')
--- /dev/fd/63	2020-07-16 17:18:04.850623647 -0700
+++ /dev/fd/62	2020-07-16 17:18:04.850623647 -0700
@@ -1,20 +1,15 @@
 /var/www/html
 .
 ..
 .csslintrc
-.editorconfig
 .eslintignore
 .eslintrc.json
-.gitattributes
 .ht.router.php
 .htaccess
 INSTALL.txt
-LICENSE.txt
 README.txt
 autoload.php
-composer.json
-composer.lock
 core
 example.gitignore
 index.php
 modules
@@ -22,11 +17,15 @@
 robots.txt
 sites
 themes
 update.php
-vendor
 web.config
 
 ../
 .
 ..
+.editorconfig
+.gitattributes
+composer.json
+composer.lock
 html
+vendor

New tags:

diff -u ../official-images/library/drupal <(./generate-stackbrew-library.sh)
--- ../official-images/library/drupal	2020-07-09 17:04:35.585703412 -0700
+++ /dev/fd/63	2020-07-16 17:01:56.305313625 -0700
@@ -1,50 +1,65 @@
-# this file is generated via https://github.com/docker-library/drupal/blob/ceed8c29e38959d66e28554ec9aae1cc65a66a9d/generate-stackbrew-library.sh
+# this file is generated via https://github.com/docker-library/drupal/blob/999ac2500a68be029d7218a8f921200d2996e51a/generate-stackbrew-library.sh
 
 Maintainers: Tianon Gravi <admwiggin@gmail.com> (@tianon),
              Joseph Ferguson <yosifkit@gmail.com> (@yosifkit)
 GitRepo: https://github.com/docker-library/drupal.git
 
-Tags: 8.9.2-apache, 8.9-apache, 8-apache, apache, 8.9.2, 8.9, 8, latest
+Tags: 9.0.2-apache-buster, 9.0-apache-buster, 9-apache-buster, apache-buster, 9.0.2-apache, 9.0-apache, 9-apache, apache, 9.0.2, 9.0, 9, latest
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: e382bbf87765657ae8761e404cb3e4b28674c40b
-Directory: 8.9/apache
+GitCommit: 078526440cf067eb9ef196fdd9a61d0cd842df52
+Directory: 9.0/apache-buster
 
-Tags: 8.9.2-fpm, 8.9-fpm, 8-fpm, fpm
+Tags: 9.0.2-fpm-buster, 9.0-fpm-buster, 9-fpm-buster, fpm-buster, 9.0.2-fpm, 9.0-fpm, 9-fpm, fpm
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: e382bbf87765657ae8761e404cb3e4b28674c40b
-Directory: 8.9/fpm
+GitCommit: 078526440cf067eb9ef196fdd9a61d0cd842df52
+Directory: 9.0/fpm-buster
 
-Tags: 8.9.2-fpm-alpine, 8.9-fpm-alpine, 8-fpm-alpine, fpm-alpine
+Tags: 9.0.2-fpm-alpine3.12, 9.0-fpm-alpine3.12, 9-fpm-alpine3.12, fpm-alpine3.12, 9.0.2-fpm-alpine, 9.0-fpm-alpine, 9-fpm-alpine, fpm-alpine
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: e382bbf87765657ae8761e404cb3e4b28674c40b
-Directory: 8.9/fpm-alpine
+GitCommit: 078526440cf067eb9ef196fdd9a61d0cd842df52
+Directory: 9.0/fpm-alpine3.12
 
-Tags: 8.8.8-apache, 8.8-apache, 8.8.8, 8.8
+Tags: 8.9.2-apache-buster, 8.9-apache-buster, 8-apache-buster, 8.9.2-apache, 8.9-apache, 8-apache, 8.9.2, 8.9, 8
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 8194d369e4ac30f2858c57f225133316d71fd04b
-Directory: 8.8/apache
+GitCommit: 078526440cf067eb9ef196fdd9a61d0cd842df52
+Directory: 8.9/apache-buster
 
-Tags: 8.8.8-fpm, 8.8-fpm
+Tags: 8.9.2-fpm-buster, 8.9-fpm-buster, 8-fpm-buster, 8.9.2-fpm, 8.9-fpm, 8-fpm
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 8194d369e4ac30f2858c57f225133316d71fd04b
-Directory: 8.8/fpm
+GitCommit: 078526440cf067eb9ef196fdd9a61d0cd842df52
+Directory: 8.9/fpm-buster
 
-Tags: 8.8.8-fpm-alpine, 8.8-fpm-alpine
+Tags: 8.9.2-fpm-alpine3.12, 8.9-fpm-alpine3.12, 8-fpm-alpine3.12, 8.9.2-fpm-alpine, 8.9-fpm-alpine, 8-fpm-alpine
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 8194d369e4ac30f2858c57f225133316d71fd04b
-Directory: 8.8/fpm-alpine
+GitCommit: 078526440cf067eb9ef196fdd9a61d0cd842df52
+Directory: 8.9/fpm-alpine3.12
 
-Tags: 7.72-apache, 7-apache, 7.72, 7
+Tags: 8.8.8-apache-buster, 8.8-apache-buster, 8.8.8-apache, 8.8-apache, 8.8.8, 8.8
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 5c214244f66447edfb98c2091f85df32c9f00f52
-Directory: 7/apache
+GitCommit: 078526440cf067eb9ef196fdd9a61d0cd842df52
+Directory: 8.8/apache-buster
 
-Tags: 7.72-fpm, 7-fpm
+Tags: 8.8.8-fpm-buster, 8.8-fpm-buster, 8.8.8-fpm, 8.8-fpm
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 5c214244f66447edfb98c2091f85df32c9f00f52
-Directory: 7/fpm
+GitCommit: 078526440cf067eb9ef196fdd9a61d0cd842df52
+Directory: 8.8/fpm-buster
 
-Tags: 7.72-fpm-alpine, 7-fpm-alpine
+Tags: 8.8.8-fpm-alpine3.12, 8.8-fpm-alpine3.12, 8.8.8-fpm-alpine, 8.8-fpm-alpine
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 5c214244f66447edfb98c2091f85df32c9f00f52
-Directory: 7/fpm-alpine
+GitCommit: 078526440cf067eb9ef196fdd9a61d0cd842df52
+Directory: 8.8/fpm-alpine3.12
+
+Tags: 7.72-apache-buster, 7-apache-buster, 7.72-apache, 7-apache, 7.72, 7
+Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
+GitCommit: 078526440cf067eb9ef196fdd9a61d0cd842df52
+Directory: 7/apache-buster
+
+Tags: 7.72-fpm-buster, 7-fpm-buster, 7.72-fpm, 7-fpm
+Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
+GitCommit: 078526440cf067eb9ef196fdd9a61d0cd842df52
+Directory: 7/fpm-buster
+
+Tags: 7.72-fpm-alpine3.12, 7-fpm-alpine3.12, 7.72-fpm-alpine, 7-fpm-alpine
+Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
+GitCommit: 078526440cf067eb9ef196fdd9a61d0cd842df52
+Directory: 7/fpm-alpine3.12

@tianon
Copy link
Member

tianon commented Jul 17, 2020

@skyred if you can spare some time to review this, it would be very much appreciated! 🙏 ❤️

@skyred
Copy link
Contributor

skyred commented Jul 18, 2020

Thank you for asking. I will be happy to

cd /var/www/; \
# composer won't install to a non-empty dir: 'Project directory "/var/www/" is not empty.'
rmdir /var/www/html; \
composer create-project --no-install "drupal/recommended-project:$DRUPAL_VERSION" ./; \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully the time period between releases to https://github.com/drupal/drupal/releases (and I guess more relevantly, new version numbers presented in the update API we're scraping) and new tags on https://github.com/drupal/recommended-project/releases is short. 😅

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This repository is auto-generated based on https://git.drupalcode.org/project/drupal/-/tree/8.8.x/composer%2FTemplate%2FRecommendedProject

So, I would hope this will be updated in a timely fashion on each release.

# composer won't install to a non-empty dir: 'Project directory "/var/www/" is not empty.'
rmdir /var/www/html; \
composer create-project --no-install "drupal/recommended-project:$DRUPAL_VERSION" ./; \
sed -i 's!web/!html/!g' composer.json; \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we maybe not do this for 9.0+? (I understand why we would do it for 8.x to keep backwards compatibility, but if it's the "recommended" layout, perhaps we should follow it for the new versions and update our Apache configuration instead?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking to always do it so that we don't have the weird transition for users where they get confused that their mount for /var/www/html/modules no longer works (https://github.com/docker-library/docs/tree/2d2443ed9d71dafa0f328b546c39f6562603ce7d/drupal#volumes)

(honestly the "recommended" layout should have some way to choose the target subdirectory)

I guess we could do both by installing to web and making html a symlink?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Letting it install where they "recommend" and having our own symlink seems sane IMO -- gives us a good balance of following their official layout and not breaking users.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can provide it like:

composer create-project --no-install "drupal/recommended-project:$DRUPAL_VERSION"  /var/www/html

per the documentation:
https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies#s-create-a-project

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or am I misunderstanding the problem?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as far as I know, the "root" composer.json file is "customizable" by the user (i.e. you would not use it to load modules or themes or whatever). So I think it's fine to modify it when you build it. Personally... it seems a little gross, but better than having a symlink that I might not know about....

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be weird if someone mounts the /var/www folder and expects the web subdirectory to work, but I would just document that they need to change web to html in their composer.json

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What it sounds like is that we're maybe looking at the problem in the wrong way -- what if we instead install to something like /opt/drupal, and then make /var/www/html a symlink out to /opt/drupal/web? Then we get the best of both hacks, without all the weird edge cases:

  • bind mounts into /var/www/html/... will still work
  • no Apache configuration changes required
  • users can still provide all of /var/www/html or even use /opt/drupal themselves to manage (and the standard "recommended" layout will Just Work)

Maybe there's even an official upstream-recommended location for a "system" install (rather than inventing /opt/drupal ourselves)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems reasonable to me. That means /opt/drupal will point to it's subdirectory web and /var/html wont contain the composer.json file in the first place. :)

I do not know of a system install location convention, so whatever you think is best. Is there a convention in Docker? maybe /app?

The documentation should probably be updated to use/mount /opt/drupal (and I suppose that should be the WORKDIR ?) instead of /var/www.

It would be nice if I could extend the image, and do something like:

 composer require 'drupal/paragraphs:^1.12'

and have it install the Paragraphs module as is described in the documentation:
https://www.drupal.org/project/paragraphs/releases/8.x-1.12

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great example usage! After some tweaks that I'll push up shorty, this will work just fine.

$ docker build -
FROM drupal:8.9-new
RUN composer require 'drupal/paragraphs:^1.12'

Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM drupal:8.9-new
 ---> 82e0b578fbc4
Step 2/2 : RUN composer require 'drupal/paragraphs:^1.12'
 ---> Running in d7ad66c57f7b
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension.
This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.
Installing 'unzip' may remediate them.
  - Installing drupal/entity_reference_revisions (1.8.0): Downloading (100%)         
  - Installing drupal/paragraphs (1.12.0): Downloading (100%)         
drupal/paragraphs suggests installing drupal/entity_browser (Recommended for an improved user experience when using the Paragraphs library module)
Writing lock file
Generating autoload files
23 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Removing intermediate container d7ad66c57f7b
 ---> fc0923aa982b
Successfully built fc0923aa982b

8.8/apache-buster/Dockerfile Outdated Show resolved Hide resolved
8.8/apache-buster/Dockerfile Outdated Show resolved Hide resolved
update.sh Outdated Show resolved Hide resolved
update.sh Outdated Show resolved Hide resolved
update.sh Outdated Show resolved Hide resolved
update.sh Outdated Show resolved Hide resolved
@yosifkit
Copy link
Member Author

yosifkit commented Aug 5, 2020

Basically the same diff as before but the workdir is relatively one level up (to support RUN composer require ...) and moved under /opt.

diff -U 4  <(docker run -i --rm drupal:8.9 sh -c 'pwd; ls -a; echo; echo '../'; ls -a ../') <(docker run -i --rm drupal:8.9-new sh -c 'echo "$PWD/web"; ls -a web/; echo; echo './'; ls -a ./')
--- /dev/fd/63	2020-08-05 15:05:43.442129748 -0700
+++ /dev/fd/62	2020-08-05 15:05:43.443129771 -0700
@@ -1,20 +1,15 @@
-/var/www/html
+/opt/drupal/web
 .
 ..
 .csslintrc
-.editorconfig
 .eslintignore
 .eslintrc.json
-.gitattributes
 .ht.router.php
 .htaccess
 INSTALL.txt
-LICENSE.txt
 README.txt
 autoload.php
-composer.json
-composer.lock
 core
 example.gitignore
 index.php
 modules
@@ -22,11 +17,15 @@
 robots.txt
 sites
 themes
 update.php
-vendor
 web.config
 
-../
+./
 .
 ..
-html
+.editorconfig
+.gitattributes
+composer.json
+composer.lock
+vendor
+web

@tianon
Copy link
Member

tianon commented Aug 6, 2020

Just copying the excellent use case/example from #176 (comment) so we don't lose it; this will make things like the following possible:

FROM drupal:8.9
RUN composer require 'drupal/paragraphs:^1.12'

@tianon tianon merged commit e7d2cad into docker-library:master Aug 6, 2020
@tianon tianon deleted the 9.0-rc branch August 6, 2020 00:28
docker-library-bot added a commit to docker-library-bot/official-images that referenced this pull request Aug 6, 2020
Changes:

- docker-library/drupal@201b7c0: Update to 8.9.3
- docker-library/drupal@be98c13: Update to 9.0.3
- docker-library/drupal@e7d2cad: Merge pull request docker-library/drupal#176 from infosiftr/9.0-rc
- docker-library/drupal@530833e: Move installation to /opt/drupal; symlink from /var/www/html
- docker-library/drupal@4a5ce8d: Keep templates for 7, minor 8&9 fixes
- docker-library/drupal@e2c7e05: Update generated README
- docker-library/drupal@999ac25: Skip --from files when finding the commit
- docker-library/drupal@0785264: Reorganize to be explicit about Alpine version as well as Debian release
- docker-library/drupal@71ffa1c: Add drupal 9.0 release
docker-library-bot added a commit to docker-library-bot/official-images that referenced this pull request Aug 6, 2020
Changes:

- docker-library/drupal@8620ae0: Fix Architectures calculation to take *all* FROM values into account
- docker-library/drupal@201b7c0: Update to 8.9.3
- docker-library/drupal@be98c13: Update to 9.0.3
- docker-library/drupal@e7d2cad: Merge pull request docker-library/drupal#176 from infosiftr/9.0-rc
- docker-library/drupal@530833e: Move installation to /opt/drupal; symlink from /var/www/html
- docker-library/drupal@4a5ce8d: Keep templates for 7, minor 8&9 fixes
- docker-library/drupal@e2c7e05: Update generated README
- docker-library/drupal@999ac25: Skip --from files when finding the commit
- docker-library/drupal@0785264: Reorganize to be explicit about Alpine version as well as Debian release
- docker-library/drupal@71ffa1c: Add drupal 9.0 release
alberto56 added a commit to dcycle/docker-drupal that referenced this pull request Aug 17, 2020
alberto56 added a commit to dcycle/docker-drupal that referenced this pull request Aug 18, 2020
alberto56 added a commit to dcycle/docker-drupal that referenced this pull request Aug 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Drupal 9 release
6 participants