Skip to content

Commit

Permalink
Dockerized for demo
Browse files Browse the repository at this point in the history
  • Loading branch information
waj committed Dec 1, 2015
1 parent eea2b1b commit 60d5694
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.git
.bundle
log
tmp
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM instedd/nginx-rails:2.2

## Create a user for the web app.
RUN \
addgroup --gid 9999 app && \
adduser --uid 9999 --gid 9999 --disabled-password --gecos "Application" app && \
usermod -L app

# Install gem bundle
ADD Gemfile /app/
ADD Gemfile.lock /app/
RUN bundle install --jobs 8 --deployment --without development test

# Install the application
ADD . /app

# Precompile assets
RUN bundle exec rake assets:precompile RAILS_ENV=production

# Set permissions for tmp and log directories
RUN mkdir -p /app/tmp /app/log && chown -R app:app /app/tmp /app/log

# Add config files
ADD docker/web-run /etc/service/web/run
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
web:
build: .
links:
- db
log_driver: gelf
log_opt:
gelf-address: udp://localhost:12201

db:
image: postgres:9.3.5
log_driver: gelf
log_opt:
gelf-address: udp://localhost:12201

4 changes: 4 additions & 0 deletions docker/web-run
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
source /etc/envvars
cd /app
exec su -p -c "/usr/local/bundle/bin/puma $PUMA_OPTIONS -e $RAILS_ENV -b unix:///app/tmp/app.sock" app

0 comments on commit 60d5694

Please sign in to comment.