Merge pull request #19 from 0x46616c6b/dockerfile

add dockerfile and docker-compose.yml
This commit is contained in:
Hakan Ensari 2016-04-08 00:09:16 +02:00
commit 51c315f949
3 changed files with 49 additions and 0 deletions

16
Dockerfile Normal file
View File

@ -0,0 +1,16 @@
FROM ruby:2.3.0
ENV WORKER_PROCESSES 4
ENV DATABASE_URL postgres://postgres:mysecretpassword@postgres/fixer
ENV VERSION 1
RUN mkdir /fixer-io
WORKDIR /fixer-io
ADD Gemfile /fixer-io/Gemfile
ADD Gemfile.lock /fixer-io/Gemfile.lock
RUN bundle install --deployment --without development:test
ADD . /fixer-io
EXPOSE 8080
CMD bundle exec unicorn -p 8080 -c /fixer-io/config/unicorn.rb

View File

@ -1,3 +1,5 @@
# Fixer.io
[![Travis](https://travis-ci.org/hakanensari/fixer-io.svg)](https://travis-ci.org/hakanensari/fixer-io)
<img src="http://fixer.io/img/money.png" alt="fixer" width=180 align="middle">
@ -5,3 +7,14 @@
Fixer.io is a free JSON API for current and historical foreign exchange rates published by the European Central Bank.
The rates are updated daily around 3PM CET.
## Docker
```
# bring the stack up
docker-compose up -d
# initialize the database (postgres need a short time to come up)
docker-compose run fixer rake db:migrate rates:load
```

20
docker-compose.yml Normal file
View File

@ -0,0 +1,20 @@
version: '2'
services:
postgres:
image: postgres
ports:
- 5432:5432
environment:
- POSTGRES_DB=fixer
fixer:
build: .
command: bundle exec unicorn -p 8080 -c /fixer-io/config/unicorn.rb
volumes:
- .:/fixer-io
ports:
- 8080:8080
environment:
- RACK_ENV=production
- DATABASE_URL=postgres://postgres:mysecretpassword@postgres/fixer
depends_on:
- postgres