marmelab / gaudi

Gaudi allows to share multi-component applications, based on Docker, Go, and YAML.

Home Page:http://gaudi.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow to use before_script in configuration file

manuquentin opened this issue · comments

Use before_script : and check

  • if it's a file : run it at the startup
  • otherwise execute the command in a Docker RUN

You may have problems ordering before_scripts on several containers. Example:

  1. I must populate a db from the db container
  2. I must setup a webapp on a php container

How can I execute scripts on different containers in a certain order?

The before_script will behave like the Travis one and will be put in the DockerFile. With the configuration :

containers:
    db:
        type: mysql
        ports:
            3306: 3306
        custom:
            before_script: mysql -e "CREATE DATABASE symfony CHARACTER SET utf8 COLLATE utf8_general_ci;"

The script will be executed only once before the boot of the mysql daemon.

If the before script is too huge, it can be put in a bin/setup-mysql.sh and will be executed the same way with :

custom:
    before_script: setup-mysql.sh