lando / lagoon

The Official Lagoon Lando Plugin
https://docs.lando.dev/lagoon
GNU General Public License v3.0
2 stars 4 forks source link

Lando doesn't seem to respect build context with Lagoon #7

Open mglaman opened 3 years ago

mglaman commented 3 years ago

Tell us about your setup

v3.0.23 macOS Big Sur

Tell us about your .lando.yml Lagoon recipe.

name: contribkanban
recipe: lagoon
config:
  build:
    - composer install

It is also helpful to include other relevant config files. For example, include pantheon.yml for a pantheon recipe if applicable. Include php.ini or mysql.cnf if you are overriding our defualt config.

Tell us about the command you were running

Paste in a series of commands that caused the bug.

Example:

lando start

Tell us about the error you got

My Dockerfile commands are failing even though they build fine in Lagoon. Mostly file paths, meaning it's ignoring the build context and always using the root dir.

Example:

Done in 48.09s.
Removing intermediate container edccc5e5cc65
 ---> 8b152999e911

Step 12/16 : FROM amazeeio/nginx
 ---> 4b6ea22e6751
Step 13/16 : COPY --from=builder /app/build /app
ERROR: Service 'frontend' failed to build : COPY failed: stat app/build: file does not exist
ERROR ==>  message=, stack=Error
    at /snapshot/lando/build/cli/lib/shell.js
From previous event:

Tell us generally about your bug

ContribKanban is a mono repo with a frontend React app. The frontend app is in frontend. This is my docker-compose.yml

services:
  frontend:
    build:
      context: frontend
      dockerfile: ../lagoon/Dockerfile.app
    labels:
      # Lagoon Labels
      lagoon.type: nginx
      lando.type: nginx
    environment:
      <<: *default-environment
      LAGOON_LOCALDEV_URL: contribkanban-app.docker.amazee.io
      REACT_APP_API_HOSTNAME: http://drupal-varnish.contribkanban-app.docker.amazee.io/
    networks:
      - amazeeio-network
      - default

First it died on ../lagoon/Dockerfile.app and I thought it was a fluke. I changed that and it kept dying. This is because the context of context: frontend is not respected. Lando is always using the root dir as context.

mglaman commented 3 years ago

Workaround: remove lando.type so the frontend is ignored. I can run it locally via yarn start.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions and please check out this if you are wondering why we auto close issues.