dockerlando

Mount folder into webroot with Lando


So I have 2 folders next to each other, "cms" and "project-1". The "project-1" folder contains the lando file. I'm trying to mount the cms folder inside the webroot in order to create a proxy for it.

enter image description here

name: project-1
recipe: lamp
config:
  webroot: .
proxy:
  site:
    - project-1-site.lndo.site
  cms:
    - project-1-cms.lndo.site
services:
  webserver:
    type: php:7.3
    via: apache:2.4
    ssl: true
  database:
    type: mariadb:10.1.47
  pma:
    type: phpmyadmin
    hosts:
      - database
  site:
    type: php:7.3
    via: apache:2.4
    ssl: true
    webroot: /public
    build_as_root:
      - a2enmod headers
  cms:
    type: php:7.3
    via: apache:2.4
    ssl: true
    webroot: ../cms
    build_as_root:
      - a2enmod headers

What would be the best way to achieve this result? I don't want to move the lando file in the same folder as the "cms" and "project-1" folders.

I have tried the cp command in build_as_root but it seems impossible to target content outside of the folder where the lando file is located.


Solution

  • I used the drupal7 recipe and mounting an outside folder worked for me as follows:

    Assuming the following project folder setup:

    The following lando config worked:

    name: my-project
    recipe: drupal7
    config:
      webroot: .
    services:
      appserver:
        # Keys 'app_mount' and overrides/volumes allow outside lando folder.
        # @see https://docs.lando.dev/compose/config.html
        # @see https://github.com/lando/lando/issues/1487#issuecomment-619093192
        app_mount: delegated
        overrides:
          volumes:
            - "../cms:/app"