-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7369067
Showing
7 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.erb] | ||
indent_size = 4 | ||
draw_indent_guides = true | ||
|
||
[*.sass] | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
*.rbc | ||
capybara-*.html | ||
.rspec | ||
/log | ||
/tmp | ||
/db/*.sqlite3 | ||
/db/*.sqlite3-journal | ||
/public/system | ||
/coverage/ | ||
/spec/tmp | ||
**.orig | ||
rerun.txt | ||
pickle-email-*.html | ||
|
||
# TODO Comment out this rule if you are OK with secrets being uploaded to the repo | ||
config/initializers/secret_token.rb | ||
|
||
# Only include if you have production secrets in this file, which is no longer a Rails default | ||
# config/secrets.yml | ||
|
||
# dotenv | ||
# TODO Comment out this rule if environment variables can be committed | ||
.env | ||
|
||
## Environment normalization: | ||
/.bundle | ||
/vendor/bundle | ||
|
||
# these should all be checked in to normalize the environment: | ||
# Gemfile.lock, .ruby-version, .ruby-gemset | ||
|
||
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: | ||
.rvmrc | ||
|
||
# if using bower-rails ignore default bower_components path bower.json files | ||
/vendor/assets/bower_components | ||
*.bowerrc | ||
bower.json | ||
|
||
# Ignore pow environment settings | ||
.powenv | ||
|
||
# Ignore Byebug command history file. | ||
.byebug_history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM ruby:2.3.1 | ||
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs | ||
|
||
RUN mkdir /app | ||
WORKDIR /app | ||
|
||
ADD Gemfile /app/Gemfile | ||
ADD Gemfile.lock /app/Gemfile.lock | ||
|
||
RUN bundle install | ||
ADD . /app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source 'https://rubygems.org' | ||
|
||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | ||
gem 'rails', '~> 5.0.0' |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Rails 5 Docker boilerplate | ||
|
||
Boilerplate for Rails projects using Docker. | ||
|
||
|
||
## Building the project | ||
|
||
Run the following command to create a new Rails project scaffold with a postgres database. | ||
|
||
```bash | ||
docker-compose run web rails new . --force --database=postgresql --skip-bundle | ||
``` | ||
|
||
In order to have a JavaScript runtime you have to uncomment this line in your Gemfile. | ||
``` | ||
gem 'therubyracer', platforms: :ruby | ||
``` | ||
|
||
After that build the project in order to install new Gems. | ||
|
||
```bash | ||
docker-compose build | ||
``` | ||
|
||
## Database | ||
|
||
Use the following configuration for your **development** and **test** databases. | ||
|
||
```yaml | ||
development: &default | ||
adapter: postgresql | ||
encoding: unicode | ||
database: postgres | ||
pool: 5 | ||
username: postgres | ||
password: | ||
host: db | ||
|
||
test: | ||
<<: *default | ||
database: myapp_test | ||
``` | ||
After this you can run the project and get ready to create the database. | ||
```bash | ||
$ docker-compose up | ||
``` | ||
|
||
Run this command to create the database. | ||
|
||
```bash | ||
$ docker-compose run web rake db:create | ||
``` | ||
|
||
## Running | ||
|
||
At this point your application must be running on localhost on port 3000, so head over to it and take a look! | ||
|
||
[http://localhost:3000](http://localhost:3000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: '2' | ||
services: | ||
db: | ||
image: postgres | ||
web: | ||
build: . | ||
command: bash -c "rm tmp/pids/server.pid & bundle exec rails s -p 3000 -b '0.0.0.0'" | ||
volumes: | ||
- .:/app | ||
ports: | ||
- "3000:3000" | ||
depends_on: | ||
- db |