Search code examples
cloud-foundryswisscomdev

How to add additional dependencies to php-buildpack in CloudFoundry


We use the PHP-Buildpack to run our app on a CloudFoundry Service.

To Backup the Database we wan't to use the mysqldump command, therefore we need a way to install mysql-client in the buildpack.

Do we have to create our own php build-pack every time we need a custom dependencies or is there a easier way to install additional dependencies in the buildpack?


Solution

  • After some testing with the apt-buildpack (thank's to @FyodorGlebov) i have found a working solution.

    1. add apt.yml in the project root (documentation)

      ---
      packages:
      - mysql-client
      
    2. add multi-buildpack.yml in the project root (documentation)

      buildpacks:
      - https://github.com/cloudfoundry/apt-buildpack
      - https://github.com/cloudfoundry/php-buildpack
      
    3. Push your app with this command (documentation)

      cf push APP_NAME -b https://github.com/cloudfoundry/multi-buildpack