Customize Python runtime environment
The default Python runtime environment contains:
- Alpine 3.20
- Selected version of Python when the runtime service was created.
- zCLI
- Git and PIP
To use Ubuntu instead of the default Alpine, set the run.os attribute.
Additional packages and tools can be installed using run.prepareCommands.
Runtime Flow​
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 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 and run.prepareCommands attributes didn't change from the previous deploy
- The custom runtime cache wasn't invalidated in the Zerops GUI.
To invalidate the Zerops runtime cache go to your service detail in Zerops GUI, choose Service dashboard & runtime containers from the left menu and click on the Open pipeline detail button. Then click on the Clear runtime prepare cache button.
When the custom runtime cache is used, Zerops doesn't create a prepare runtime container and executes the deployment of your application directly.