0.0
No commit activity in last 3 years
No release in over 3 years
The Gem can be used to parse and convert a Dockerfile to a Bash script.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.16.a
~> 10.0

Runtime

 Project Readme

Dockerfile2bash - Convert a Dockerfile to Bash

Dockerfile2bash is used to parse a Dockerfile and convert it to a Bash script eventually. Maybe you can use it to convert massive Dockerfiles to shell scripts used in a metal installation.

Installation

Add this line to your application's Gemfile:

gem 'dockerfile2bash'

And then execute:

$ bundle

Or install it yourself as:

$ gem install dockerfile2bash

Usage

require 'dockerfile2bash'

df = Dockerfile2bash.new(<your_Dockerfile_path>)
# parse it at first and check the commands
commands = df.parse
# then convert it to a Bash script
puts df.generate_bash

and note that you can take a GitHub url of a Dockerfile as a Dockerfile path. For example:

require 'dockerfile2bash'

df = Dockerfile2bash.new("https://github.com/openresty/docker-openresty/blob/master/xenial/Dockerfile")
# or better its raw content url
df = Dockerfile2bash.new("https://raw.githubusercontent.com/openresty/docker-openresty/master/xenial/Dockerfile")
# ...

Commandline tool

A command named df2sh released with Dockerfile2bash. After installation the command will be available in your shell path.

df2sh /path/to/your/Dockerfile [output_bash_filename]

out.sh will be used as output filename in current directory if the output_bash_filename is omitted.

And here're some examples of generated scripts: examples.

Development

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

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/beijingrb/dockerfile2bash. 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.

Code of Conduct

Everyone interacting in the dockerfile2bash project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.