Skip to content

Commit e967063

Browse files
trezyAriel-Thomas
authored andcommitted
Add Docker configuration (#136)
* Add Docker configuration
1 parent 683b729 commit e967063

File tree

5 files changed

+63
-12
lines changed

5 files changed

+63
-12
lines changed

.env.example

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,10 @@ SECRET_KEY_BASE=
44
SENDGRID_USERNAME=
55
SENDGRID_PASSWORD=
66
DEVISE_SECRET_KEY=
7-
DEVISE_MAILER_SENDER=[email protected]
7+
DEVISE_MAILER_SENDER=[email protected]
8+
9+
ALL_DATABASE_HOST=postgres
10+
ALL_DATABASE_NAME=adventurers_league_log_development
11+
ALL_DATABASE_PASSWORD=postgres
12+
ALL_DATABASE_PORT=5432
13+
ALL_DATABASE_USERNAME=postgres

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@
44
# or operating system, you probably want to add a global ignore instead:
55
# git config --global core.excludesfile '~/.gitignore_global'
66

7+
# Ignore macOS files
8+
.DS_Store
9+
710
# Ignore bundler config.
811
/.bundle
912

1013
# Ignore the default SQLite database.
1114
/db/*.sqlite3
1215
/db/*.sqlite3-journal
1316

17+
# Ignore files from database container
18+
/tmp/db
19+
1420
# Ignore all logfiles and tempfiles.
1521
/log/*.log
1622
/tmp

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM ruby:2.3.1
2+
3+
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
4+
5+
WORKDIR /app
6+
7+
ADD Gemfile Gemfile.lock Rakefile ./
8+
9+
RUN bundle install
10+
11+
COPY . /app

config/database.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
1+
development: &default
2+
adapter: postgresql
3+
pool: 5
4+
timeout: 5000
5+
6+
7+
8+
9+
110
# SQLite version 3.x
211
# gem install sqlite3
312
#
413
# Ensure the SQLite 3 gem is defined in your Gemfile
514
# gem 'sqlite3'
615
development:
7-
adapter: postgresql
16+
<<: *default
817
database: adventurers_league_log_development
9-
pool: 5
10-
timeout: 5000
18+
1119

1220
# Warning: The database defined as "test" will be erased and
1321
# re-generated from your development database when you run "rake".
1422
# Do not set this db to the same as development or production.
1523
test:
16-
adapter: postgresql
17-
database: adventurers_league_log_test
18-
pool: 5
19-
timeout: 5000
24+
<<: *default
25+
database: adventurers_league_log_test
2026

2127
production:
22-
adapter: postgresql
23-
database: adventurers_league_log_production
24-
pool: 5
25-
timeout: 5000
28+
<<: *default
29+
database: adventurers_league_log_production

docker-compose.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: "3"
2+
3+
services:
4+
app:
5+
build: .
6+
command: rails s -b '0.0.0.0'
7+
environment:
8+
- DATABASE_URL=postgres://${ALL_DATABASE_USERNAME}:${ALL_DATABASE_PASSWORD}@${ALL_DATABASE_HOST}:${ALL_DATABASE_PORT}/${ALL_DATABASE_NAME}
9+
ports:
10+
- 3000:3000
11+
volumes:
12+
- .:/app
13+
working_dir: /app
14+
15+
postgres:
16+
image: postgres:alpine
17+
environment:
18+
- POSTGRES_HOST=postgres
19+
- POSTGRES_PASSWORD=${ALL_DATABASE_PASSWORD}
20+
- POSTGRES_USER=${ALL_DATABASE_USERNAME}
21+
ports:
22+
- 5432:5432
23+
volumes:
24+
- ./tmp/db:/var/lib/postgresql/data

0 commit comments

Comments
 (0)