Skip to content

Conversation

@rolandoscott
Copy link

Pygmy users will run docker compose with the base docker-compose.yml, no change, everything works with additional_contexts.

For Lando users, it will load both docker-compose.yml and docker-compose.lando.yml.

The override replaces the build blocks for php and nginx.
This strips the additional_contexts that break Lando, but keeps the CLI_IMAGE arg wiring.

@rocketeerbkw
Copy link
Member

Oops, just realized I commented on the issue last time. This PR still doesn't work for me unfortunately. I deleted the local docker images (that were built from this example in the past) and lando rebuild still fails:

➜  drupalnext-base git:(lando-additional_contexts-fix) ✗ ⎈(N/A:default)git log --pretty=short -n1
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
commit 86cd6b4f0b1492d3abcc38cd19aa78263f92a2a4 (HEAD -> lando-additional_contexts-fix, origin/lando-additional_contexts-fix)
Author: Rolando Scott <rolando@reas.cr>

    Additional modifications to nullify the additional_contexts when merging with the lando only file
➜  drupalnext-base git:(lando-additional_contexts-fix) ✗ ⎈(N/A:default)lando rebuild
? Are you sure you want to rebuild? Yes
Rising anew like a fire phoenix from the ashes! Rebuilding app...
no container to killNo stopped containers
[+] Pulling 3/3
 ✔ mailhog Pulled                                                                                                                                                                         0.6s
 ✔ lagooncli Pulled                                                                                                                                                                       0.6s
 ✔ mariadb Pulled                                                                                                                                                                         0.6s
[+] Building 0.0s (0/1)                                                                                                                                                         docker:default
[+] Building 0/0
[+] Building 0.7s (11/11)                                                                                                                                                       docker:default
 => [cli internal] load build definition from cli.dockerfile                                                                                                                              0.0s
[+] Building 0.8s (13/13) FINISHED                                                                                                                                              docker:default
 => [cli internal] load build definition from cli.dockerfile                                                                                                                              0.0s
 => => transferring dockerfile: 339B                                                                                                                                                      0.0s
 => [cli internal] load metadata for docker.io/uselagoon/php-8.4-cli-drupal:latest                                                                                                        0.0s
 => [cli internal] load .dockerignore                                                                                                                                                     0.0s
 => => transferring context: 76B                                                                                                                                                          0.0s
 => [cli 1/7] FROM docker.io/uselagoon/php-8.4-cli-drupal:latest                                                                                                                          0.0s
 => [cli internal] load build context                                                                                                                                                     0.7s
 => => transferring context: 2.25MB                                                                                                                                                       0.7s
 => CACHED [cli 2/7] COPY composer.* /app/                                                                                                                                                0.0s
 => CACHED [cli 3/7] COPY assets /app/assets                                                                                                                                              0.0s
 => CACHED [cli 4/7] RUN composer install --no-dev                                                                                                                                        0.0s
 => CACHED [cli 5/7] COPY . /app                                                                                                                                                          0.0s
 => CACHED [cli 6/7] RUN mkdir -p -v -m775 /app/web/sites/default/files                                                                                                                   0.0s
 => CACHED [cli 7/7] RUN fix-permissions /app/web/sites/default/settings.php                                                                                                              0.0s
 => [cli] exporting to image                                                                                                                                                              0.0s
[+] Building 1/3 layers                                                                                                                                                                   0.0s
 ✔ Service cli    Built                                                                                                                                                                   0.8s
 ⠋ Service php    Building                                                                                                                                                                0.0s
 ⠋ Service nginx  Building                                                                                                                                                                0.0s
failed to get build context cli: stat /home/brandon/.lando/compose/drupalnextbase/service:cli: no such file or directory
ERROR ==>

██╗   ██╗██╗  ██╗     ██████╗ ██╗  ██╗██╗
██║   ██║██║  ██║    ██╔═══██╗██║  ██║██║
██║   ██║███████║    ██║   ██║███████║██║
██║   ██║██╔══██║    ██║   ██║██╔══██║╚═╝
╚██████╔╝██║  ██║    ╚██████╔╝██║  ██║██╗
 ╚═════╝ ╚═╝  ╚═╝     ╚═════╝ ╚═╝  ╚═╝╚═╝


An unrecoverable error occurred while starting up your app!

@rolandoscott
Copy link
Author

You are right. If after you do a lando rebuild -y, you do a lando start, the application eventually does start (for me) but its not building correctly. I have been fidgeting a lot with it but can't get it to work. Stuck on this one.

@tobybellwood
Copy link
Contributor

if you switch it up so that the additional_contexts is removed from the docker-compose.yml, and instead put them into a docker-compose.override.yml as below - does that work?

this should allow lando and lagoon to use the old format, but docker compose & pygmy to autoread the override file for compatibility

services:
  nginx:
    build:
      additional_contexts:
        cli: "service:cli"
  php:
    build:
      additional_contexts:
        cli: "service:cli"

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.

4 participants