Skip to content

SeunAdelekan/DockerRails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DockerRails

alt_text

A benevolent Docker image for Ruby on Rails. Along with Rails, this image comes bundles with common tools and utilities used in Rails applications such as:

  • MySQL
  • PostgreSQL
  • Node.js
  • ImageMagick
  • Redis

Getting Started

Create a Rails application to be containerized:

rails new AwesomeApp 

Open your generated application's directory and run bundle:

cd ./AwesomeApp && bundle

Create Docker Image

Having created an application to run, you'll need to create a docker image for it. Firstly create a Dockerfile as shown below:

FROM iyanu/rails:latest

LABEL maintainer="John Wick"
LABEL name="AwesomeApp Image"
LABEL description="An image for my awesome app."

WORKDIR /src
COPY . /src

RUN bundle install

EXPOSE 3000

ENTRYPOINT ["bundle", "exec"]
CMD ["rails", "server"]

Now build your Docker image:

docker build -t awesome-app .

NOTE: DockerRails installs Rails 5.2.1 by default. To specify the rails version to be installed with your image pass a rails_version build argument to the docker build command as shown below:

docker build -t awesome-app . --build-arg rails_version=<version>

After building an image, create and run a container with the built image:

docker run -p 80:3000 awesome-app

A container for your application will be created.

View Application

To view your application, open your browser of choice and point it to http://localhost:80.

alt_text

Want to try out a quick test app? Try out the docker-rails-sample application here

License

MIT

About

A benevolent docker image for Ruby on Rails. https://hub.docker.com/r/iyanu/rails

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published