buildpacks icon indicating copy to clipboard operation
buildpacks copied to clipboard

Add custom composer arguments support

Open sl0wik opened this issue 2 years ago • 1 comments

Because of --no-dev flag composer args are suitable only for production build. To allow dev or staging work COMPOSER_ARGS environment variable is introduced.

COMPOSER_ARGS can be used to override default composer args.

sl0wik avatar Jul 14 '22 15:07 sl0wik

Perhaps I can add some more information on why this PR is important. AppEngine is a great tool in production but running apps locally was always complex. If you get a configuration mismatch between your local and production (for example with allowed functions, or dynamic modules), your app might work locally and pass unit tests, and then throw nasty 500 on production after the successful deployment.

For a long time, the only repo that was providing environment comparable to App Engine production was https://github.com/GoogleCloudPlatform/php-docker . It was constantly outdated and poorly documented.

Buildpacks opened a new way to set up local and CI/CD environments equal to production, however --no-dev flag explicitly blocks the installation of necessary dependencies.

This simple PR (which might need quick testing), would essentially allow using buildpacks for all non-production environments and provide solution to most of issues in https://github.com/GoogleCloudPlatform/php-docker/issues .

sl0wik avatar Jul 18 '22 00:07 sl0wik

COMPOSER_ARGS renamed to GOOGLE_COMPOSER_ARGS

sl0wik avatar Aug 19 '22 18:08 sl0wik

I got formatting error in the php.go file blocking the merge. I believe they are:

  1. Imports aren't sorted. "strings" import needs to be after the "path/filepath" import
  2. there are extra trailing whitespaces on the line: flags = []string{"--no-dev", "--no-progress", "--no-interaction", "--optimize-autoloader"}

you can also try running go format to see if there are other issues.

pmaloogoogle avatar Aug 19 '22 20:08 pmaloogoogle