Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Docker support (Dockerfile). #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rosstimson
Copy link

I'd like to be able to run Ginatra via Docker and instead of just creating my own I figured it would be good to have an 'official' Ginatra image on the Docker Hub Registry.

Docker needs the app to run in the foreground and I also wanted to be able to set the port the app runs on by passing Docker an environment variable. This is the reasoning behind adding Puma in order to serve the app rather than using the built-in bin/ginatra run. I added it directly to the Gemfile as I didn't want to mess with your gemspec and it technically isn't a dependency. I'm sure there is a better way to achieve the same result.

The image it creates seems excessively large at 911MB however the official Ruby image that it is based upon is 830MB so I think this is a problem with that image and should be addressed there.

If you are unfamiliar with Docker you can build the image like so:

docker build -t ginatra/ginatra .

Docker Hub will automate and do the builds for you once setup.

In order to run the built image with a custom config.yml you can do:

docker run --name ginatra \
  -p 9797:9797 \
  -v /some/config.yml:/root/.ginatra/config.yml:ro \
  -v /path/to/repos:/repos:ro \
  ginatra/ginatra

You could also pass that command -e GINATRA_PORT=8080 if you wanted to set a different port for Ginatra to run on.

&& apt-get purge -y --auto-remove cmake

EXPOSE 9797
CMD bundle exec puma --port $GINATRA_PORT ./config.ru
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to explicitly use puma server? You can start server via ginatra run command.

@NARKOZ
Copy link
Owner

NARKOZ commented Jan 11, 2015

Sorry, didn't read the PR.
I'm not familiar with the Docker. Let me play with it, and I'll review PR afterwards.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants