Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dennis-every/rails-on-docker

Dockerizing a Ruby on Rails application
https://github.com/dennis-every/rails-on-docker

docker rails ruby

Last synced: 26 days ago
JSON representation

Dockerizing a Ruby on Rails application

Awesome Lists containing this project

README

        

# Dockerizing a Ruby on Rails Application



## 📗 Table of Contents

- [📗 Table of Contents](#-table-of-contents)
- [📖 About this project ](#-about-project-)
- [🛠 Built With ](#-built-with-)
- [Tech Stack ](#tech-stack-)
- [Key Features ](#key-features-)
- [💻 Getting Started ](#-getting-started-)
- [Setup](#setup)
- [Usage](#usage)
- [Build steps](#steps)
- [👥 Author ](#-author-)
- [📝 License ](#-license-)


# 📖 Dockerizing a Ruby on Rails application

This is a demo application to show how to use Docker to containerize a Ruby on Rails application.


## 🛠 Built With

### Tech Stack


  • Ruby on Rails

  • PostgreSql

  • Puma

  • Docker



### Key Features

- **Use Docker to containerize a Ruby on Rails application**

(back to top)

## 💻 Getting Started


### Setup

- install Docker from docker.com
- git clone [email protected]:dennis-every/rails-on-docker.git
- cd rails-on-docker


### Usage

- docker compose up

(back to top)

### Build steps

- Create Dockerfile (refer to the file in repo)
- Create a Gemfile with rails version (refer to the file in repo)
- Create an empty Gemfile.lock
- Create an entrypoint.sh script to fix a Rails-specific issue that prevents the server from restarting when a certain server.pid file pre-exists. This script will be executed every time the container gets started (refer to this file in repo)
- Create a docker-compose.yml file (refer to the file in repo)
- Generate the rails app: docker compose run --no-deps web rails new . --force --database=postgresql
- docker compose build
- Update database.yml (refer to the file in repo)
- Boot the app with: docker compose up
- Create the database in another terminal, run: docker compose run web rake db:create
- Go to http://localhost:3000 on a web browser to see the Rails welcome page
- To stop the application, run docker compose down
- References: https://github.com/docker/awesome-compose/tree/master/official-documentation-samples/rails/

(back to top)

## 👥 Author

👤 **Dennis Every**

- GitHub: [@dennis-every](https://github.com/dennis-every)

(back to top)

## 📝 License

This project is [MIT](./MIT.md) licensed

(back to top)