2

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?

Nio
  • 497
  • 3
  • 6
  • 16
  • 1
    have a look at https://github.com/cloudfoundry/apt-buildpack. This should work, I didn't try out myself – Sybil Apr 25 '18 at 07:08

1 Answers1

3

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
    
Nio
  • 497
  • 3
  • 6
  • 16
  • 2
    You don't need `multi-buildpack` buildpack unless you're stuck using a really old version of Cloud Foundry. It's a little awkward, but the platform supports this automatically now: https://docs.cloudfoundry.org/buildpacks/use-multiple-buildpacks.html. – Daniel Mikusa Apr 27 '18 at 12:20
  • Can confirm Daniels comment: By now it is sufficient to do step one (»add apt.yml«) and either add the »apt-buildpack« to the manifest file (see https://docs.cloudfoundry.org/devguide/deploy-apps/manifest-attributes.html#buildpack) OR push the app with multiple buildpack arguments (`cf push APP_NAME -b https://github.com/cloudfoundry/apt-buildpack -b https://github.com/cloudfoundry/php-buildpack`). I prefer adding the buildpacks to the manifest file. – pixelbrackets Oct 19 '21 at 13:31