Skip to content

Commit

Permalink
Configure for Docker based development
Browse files Browse the repository at this point in the history
This commit adds the necessary configuration and Docker related
files to allow the application and dependencies to run within Docker
containers. Utilizing docker-compose, this also allows the orchestration
of the separate database, cache, and jobs containers apart from the
main application.
  • Loading branch information
keiththomps committed Oct 17, 2016
1 parent 1f9acc2 commit a9640d4
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ruby:2.3.1

RUN apt-get update -yqq \
&& apt-get install -yqq --no-install-recommends \
postgresql-client \
nodejs \
qt5-default \
libqt5webkit5-dev \
&& apt-get -q clean \
&& rm -rf /var/lib/apt/lists

WORKDIR /usr/src/app
COPY Gemfile* ./
RUN bundle install
COPY . .

CMD bundle exec unicorn -c ./config/unicorn.rb
8 changes: 8 additions & 0 deletions config/secrets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
development:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>

development:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>

production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
36 changes: 36 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
version: "2"

volumes:
db-data:
external: false

services:
cache:
image: memcached:1.4-alpine

db:
environment:
POSTGRES_USER:
POSTGRES_PASSWORD:
image: postgres:9.5
volumes:
- db-data:/usr/local/pgsql/data

jobs:
env_file: .env
build: .
volumes:
- .:/usr/src/app
command: bundle exec rake jobs:work
depends_on:
- db

app:
env_file: .env
build: .
volumes:
- .:/usr/src/app
ports:
- "8080:8080"
depends_on:
- db
3 changes: 3 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

ENV["RAILS_ENV"] = "test"

require "dotenv"
Dotenv.overload(".sample.env")

require File.expand_path("../../config/environment", __FILE__)

require "rspec/rails"
Expand Down

0 comments on commit a9640d4

Please sign in to comment.