https://github.com/zazk/rails-6-docker-alpine
Lightweight Rails 6 App over Docker Alpine images
https://github.com/zazk/rails-6-docker-alpine
docker docker-compose rails rails6
Last synced: 9 months ago
JSON representation
Lightweight Rails 6 App over Docker Alpine images
- Host: GitHub
- URL: https://github.com/zazk/rails-6-docker-alpine
- Owner: zazk
- Created: 2019-09-01T21:10:04.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-04-09T21:53:07.000Z (about 6 years ago)
- Last Synced: 2025-01-14T11:21:04.404Z (over 1 year ago)
- Topics: docker, docker-compose, rails, rails6
- Language: Dockerfile
- Homepage:
- Size: 2.93 KB
- Stars: 20
- Watchers: 3
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rails 6 Docker Alpine
Docker image size
```sh
$ docker images
REPOSITORY TAG SIZE
blitz_web latest 390MB
```
### Steps
1. Clone & Create
```sh
git clone git@github.com:zazk/Rails-6-Docker-Alpine.git
```
Create a new Rails application under the repository directory
```sh
cd Rails-6-Docker-Alpine
rails new . --webpack --database=postgresql
```
2. Configure:
Modify your database configuration to use the postgresql container configuration:
```yaml
default: &default
adapter: postgresql
encoding: unicode
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
host: db
username: postgres
```
Remove check Yarn
```yaml
# ./config/environments/development.rb
# Disable Yarn Check
config.webpacker.check_yarn_integrity = false
```
3. Build the project:
```sh
docker-compose build
```
4. Create the database and run the migrations:
```sh
docker-compose run --rm web bin/rails db:create
docker-compose run --rm web bin/rails db:migrate
```
5. Run the app:
```sh
docker-compose up
```
Visit your application
```
http://localhost:3000
```
### Troubleshooting
1. If you have probles with `pg` gem you should install Postgres before. On Mac `brew install postgres`
2. Ruby Version `2.5.3`