Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/grosser/dockerb
Dockerfile.erb - use ruby in your dynamic Dockerfile
https://github.com/grosser/dockerb
Last synced: 3 days ago
JSON representation
Dockerfile.erb - use ruby in your dynamic Dockerfile
- Host: GitHub
- URL: https://github.com/grosser/dockerb
- Owner: grosser
- License: mit
- Created: 2015-01-30T02:20:05.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-03-30T04:32:26.000Z (over 8 years ago)
- Last Synced: 2024-11-02T08:24:12.301Z (10 days ago)
- Language: Ruby
- Homepage:
- Size: 16.6 KB
- Stars: 12
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
Dockerfile.erb - use ruby in your dynamic Dockerfile
Install
=======```Bash
gem install dockerb
```or standalone
```Bash
curl https://rubinjam.herokuapp.com/pack/dockerb > dockerb && chmod +x dockerb
```Usage
=====`docker` generates a `Dockerfile` from your `Dockerfile.erb`
(delete it after building / do not commit it)### custom
```
RUN echo <%= "hello" + " " + "world" %>
---
RUN echo hello world
```### install_gem
Pre-install a slow gem so re-building the container is fast
- picks the correct version from Gemfile.lock
- use before Adding Gemfile.lock or bundling```
<%= install_gem 'nokogiri' %>
---
RUN gem install -v 1.6.3 nokogiri
```### bundle
- add as little as necessary to bundle
- do not fail when re-locking fails due to git not being installed (`|| bundle check`)```
<%= bundle %>
---
ADD Gemfile /app/
ADD Gemfile.lock /app/
ADD vendor/cache /app/vendor/cache
RUN bundle install --quiet --local --jobs 4 || bundle check
```Inside of ruby:
```Ruby
Dockerb.compile do
... do other things ...
end
# Dockerfile is cleaned up
```Author
======
[Michael Grosser](http://grosser.it)
[email protected]
License: MIT
[![Build Status](https://travis-ci.org/grosser/dockerb.png)](https://travis-ci.org/grosser/dockerb)