Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jigarius/docker-rails-example
Example of using Ruby on Rails with docker compose.
https://github.com/jigarius/docker-rails-example
docker docker-compose rails ruby
Last synced: about 2 months ago
JSON representation
Example of using Ruby on Rails with docker compose.
- Host: GitHub
- URL: https://github.com/jigarius/docker-rails-example
- Owner: jigarius
- Created: 2020-12-07T22:18:10.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-08-23T21:00:17.000Z (over 2 years ago)
- Last Synced: 2024-11-02T13:33:51.442Z (about 2 months ago)
- Topics: docker, docker-compose, rails, ruby
- Language: Dockerfile
- Homepage:
- Size: 29.3 KB
- Stars: 23
- Watchers: 1
- Forks: 20
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Docker Compose: Ruby on Rails Example
A simple example of using Docker Compose for developing and deploying
Ruby on Rails applications.Read the full article on [jigarius.com](https://jigarius.com/blog/ruby-on-rails-with-docker-compose).
## Getting started
Follow the steps mentioned under _existing app_ or _new app_ depending on your
situation. That will ensure that the `ror` directory is in order. After that,
follow these steps:* Destroy any existing containers with conflicting names.
* Copy `.env.example` to `.env` and modify (if required).
* Create `config/database.yml` based on `.docker/ror/example.database.yml`.
* Build an image for Ruby on Rails:
```
docker-compose build
```
* Boot up the app by running:
```
docker-compose up
```
* Create databases by running:
```
docker-compose exec web rake db:create
```Cool! Now your Rails app should be available at
[localhost:3000](http://localhost:3000).### Existing app
* Delete the contents of the `ror` directory.
* Put the files of your existing Rails app in the `ror` directory.
* The `Gemfile` should be at `ror/Gemfile`.### New app
If you want to start with a Rails app from scratch,
* Create the following files:
* `Gemfile`: You can base this on `.docker/ror/example.Gemfile`.
* `Gemfile.lock`: An empty file.
* Run the following command to install Rails. You can modify the params for
the `rails new` command as needed.
```
docker-compose run --no-deps web rails new . --force --database=postgresql
```
* For a quick Rails install, use the `--minimal` flag.## Commands
Here are some helpful commands.
* `docker-compose start`: Starts app containers.
* `docker-compose stop`: Stops app containers.
* `rake -T`: For some other helpful commands.See [docker compose docs](https://docs.docker.com/compose/) for further info on
Docker Compose.