Open fago opened 6 years ago
I think the better way to handle this to allow re-using existing phapp commands and simple add "phapp exec" as new command. Then other commands that want to use phapp can simple do
$phapp exec
in order to switch context as needed. The exec script helper can itself be clever enough to only switch into the container when needed then.
The command allows wrapping /bin/bash per project to selectively running commands in containers
It should be included in regular output, like others. e.g.
Usage examples:
Without any argument, it should default to /bin/bash - thus open a new shell.
Executing manifest commands needs to be reworked, so that the API function includes the exec wrapper always.
However, we do not want to run the exec wrapper for "build" by default. But that should be configurable per project. To achieve that, we provide the name of the command to be executed in the variable "PHAPP_COMMAND". This new variable should be provided to all commands and be documented in the README as "A variable that is set to the name of the command executed if some command script of the phapp manifest is currently executed."
Then in the project templates, we control the exec command via dotenv variables:
COMMAND_EXEC_PREFIX: "docker compose exec web"
and apply them conditionally in the manifest: