bashhookddev

Hooks in separate configuration file


I want to generate on every start of DDEV a fresh setup of my CSS files. Therefor, I want to add a hook to a separate file, that I can only use for my custom setup and no one else in my company is influenced by my config.

Is it possible to add a hook in a separate file and how can I realize that?

In my case I want to start a Bash script in the hook:

services:
  hooks:
    post-start:
      - exec: bash generateCssFiles.sh

Solution

  • Since you want to use a separate file that is not checked in or shared with your team, use the file .ddev/config.local.yaml which is automatically gitignored. (docs).

    Then use hooks and a post-start exec hook to do what you need to do. An example would be:

    hooks:
      post-start:
        - exec: path/to/generateCssFiles.sh
    

    Please see the hooks documentation, https://ddev.readthedocs.io/en/stable/users/configuration/hooks/