Generate a Docker-Compose Yaml file
Add this line to your application's Gemfile:
gem 'dockercompose-generator'
And then execute:
$ bundle
Or install it yourself as:
$ gem install dockercompose-generator
generator = DockerCompose::Generator
mysql = generator.create_service('db', 'mysql:5.6')
mysql.add_environment('mysql_root_password', 'root')
mysql.add_environment('mysql_database', 'test')
mysql.add_environment('mysql_user', 'test')
mysql.add_environment('mysql_password', 'test')
elastic = generator.create_service('elastic', 'elasticsearch:1.4')
web = generator.create_service('web', 'php:5.6-apache')
web.add_link(elastic)
web.add_link(mysql, 'mysql')
puts generator.to_yaml
will output
db:
image: mysql:5.6
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test
MYSQL_USER: test
MYSQL_PASSWORD: test
elastic:
image: elasticsearch:1.4
web:
image: php:5.6-apache
links:
- elastic
- db:mysql
Support more options thanlinks
,ports
, andenvironment
variablesAdd an Importer to seed the services
- Fork it ( https://github.com/jwhitcraft/dockercompose-generator/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request