skip to Main Content

I’m trying to install some packages outside the /vendor folder via the installer-paths composer directive.

After the deploy those packages aren’t installed in the deployment, but the ones in the vendor folders are.

There is any way to allow the Cloud build to install composer packages outside vendor folder?

I’m deploying a WordPress website to GAE php72, using a composer based boilerplate Bedrock.

I’ve tried to set the those paths to target custom folders inside the /vendor folder and it works, maybe there is some sort of security rules that allows composer install only to write into vendor?

Here is part of composer.json:

{
  // ...
  {
    "composer/installers": "^1.7",
    "wpackagist-plugin/wordpress-seo": ">=6.0",
    "wpackagist-theme/twentynineteen":"1.0"
  },
  "extra": {
    "installer-paths": {
      "web/app/mu-plugins/{$name}/": ["type:wordpress-muplugin"],
      "web/app/plugins/{$name}/": ["type:wordpress-plugin"],    
      "web/app/themes/{$name}/": ["type:wordpress-theme"]
    },
    "wordpress-install-dir": "web/wp"
  }
  //...
}

I’ve also tried to use composer post-install-cmd scripts to copy the packages from /vendor folder to the desired location, but the build fails with message:

Step #1 - "builder": Script cp vendor/plugins/* web/app/plugins handling the post-install-cmd event returned with error code 1
Step #1 - "builder": cp: target 'web/app/plugins' is not a directory
Step #1 - "builder": > cp vendor/plugins/* web/app/plugins

2

Answers


  1. Chosen as BEST ANSWER

    I actually found that deploying with:

    gcloud beta app deploy --no-cache

    installs all packages successfully even outside the /vendor folder.


  2. I don’t think it would be possible since, as Google Cloud Platform documentation states that composer specifically adds the packages to your app’s vendor/ directory, where autoload.php is generated.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search