Customise PHP runtime environment
The default PHP runtime environment contains:
- Alpine 3.19
- selected version of PHP selected when the runtime service was created.
-
, Zerops command line toolzCLI
composer
,git
andwget
.
If you prefer the Ubuntu OS instead of Alpine, set the <a href="/php/how-to/build-pipeline#os">build.os</a>
attribute to ubuntu
. To install additional packages or tools add one or more run.prepareCommands
commands to your zerops.yml
.
When the first deploy with a defined prepareCommands
attribute is triggered, Zerops will
- create a prepare runtime container
- optionally: copy selected folders or files from your build container
- run the
run.prepareCommands
commands in the defined order
Command exit code​
If any command fails, it returns an exit code other than 0 and the deploy is canceled. Read the prepare runtime log to troubleshoot the error. If the command ends successfully, it returns the exit code 0 and Zerops triggers the following command. When all prepareCommands
commands are finished, your custom runtime environment is ready for the deploy phase.
The prepare runtime container is automatically deleted after the prepare runtime phase has finished or failed.
Custom runtime environment cache​
Some packages or tools can take a long time to install. Therefore, Zerops caches your custom runtime environment after the installation of your custom packages or tools is completed. When the second or following deploy is triggered, Zerops will use the custom runtime cache from the previous deploy if following conditions are met:
- Content of the
build.addToRunPrepare
andrun.prepareCommands
attributes didn't change from the previous deploy - The custom runtime cache wasn't invalidated in the Zerops GUI.
To invalidate the custom runtime cache go to yyy
// TODO screenshot
When the custom runtime cache is used, Zerops doesn't create a prepare runtime container and executes the deployment of your application directly.