0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
A docker util for rails application
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.15.4, ~> 1.15
~> 12.1
~> 3.6
~> 0.9.9

Runtime

~> 0.8.1
>= 1.33.6, ~> 1.33
~> 1.0.0
 Project Readme

DockerizeRails

GitHub tag Gem Version Downloads Contributors

Installation

Add this line to your rails application's Gemfile:

gem 'dockerize_rails'

And then execute:

$ bundle install

Usage

First create the configuration file .dockerize.yml for the gem itself. Run: bundle exec dock configure to generate the template. Use --tiny option to skip the description of configuration fields: bundle exec dock configure --tiny.

To create the docker config files (Dockerfile, provisions, docker-compose.yml etc.) run: bundle exec dock dockerize. To create docker environment for running tests use --test-env option: bundle exec dock dockerize --test-env.

Use docker-compose to run application in docker: docker-compose build && docker-compose up -d.

If you see migration error in browser run the following commands:

$ docker-compose down        # stop and destroy all running containers
$ docker-compose up -d mysql # if application uses postgresql database use 'postgresql' instead of 'mysql'
$ sleep 30                   # wait 30 seconds to let the database container start properly
$ docker-compose up -d rails # now start the rails container

To remove docker configurations: bundle exec dock undockerize. Use --purge option to remove .dockerize.yml file: bundle exec dock undockerize --purge

All available commands:

$ bundle exec dock help
$ bundle exec dock configure [ --tiny ]
$ bundle exec dock dockerize [ --test-env ]
$ bundle exec dock undockerize [ --purge ]
$ bundle exec dock docker_info
$ bundle exec dock docker_pull
$ bundle exec dock docker_build [ --log | --rebuild | --rebuild --force ]
$ bundle exec dock docker_start
$ bundle exec dock docker_stop [ --delete ]
$ bundle exec dock docker_delete [ --force ]

Help message:

Usage: dock <command>
   or: bundle exec dock <command>

   commands:

        configure, c, rc, cr           - Generates '.dockerize.yml'
          [--tiny]        -- Generates shorter config file, skipping all descriptions

        dockerize, dc, d               - Generates docker config files
          [--test-env]    -- Generates configurations to run tests.

        undockerize, ud, du, u, dd     - Removes docker configurations
          [--purge]       -- Also removes .dockerize.yml

        docker_info, info              - Shows Docker information
        docker_pull, pull              - Pulls base Docker images (ruby, mysql/postgres)
        docker_build, build            - Builds Docker images
          [--log]         -- Displays/Streams build log
          [--rebuild]     -- Deletes images if exists and rebuilds
          [--force]       -- Force Image deletion. Works only with --rebuild option

        docker_start, start            - Run/Starts Docker containers
        docker_stop, stop              - Stops Docker containers
          [--delete]      -- Also deletes the containers

        docker_delete, delete          - Deletes Docker containers
          [--force]       -- Force Container deletion.

        help, h                        - Prints this message

Demonstration (V: 1.0.1.beta.2)

asciicast

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/eendroroy/dockerize_rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

FOSSA Status