diff options
| author | mo <mokha@cisco.com> | 2017-04-19 21:14:33 -0600 |
|---|---|---|
| committer | mo <mokha@cisco.com> | 2017-04-19 21:14:33 -0600 |
| commit | 0b677e718dbe57796b79d546d02ffbd15ab5fc30 (patch) | |
| tree | 9d3716e3536edb5e6fc696040218701a225548c7 | |
| parent | 438e481ca6749560e2277a4ae318b82d9f3b1c48 (diff) | |
add docker.
| -rw-r--r-- | Dockerfile | 22 | ||||
| -rw-r--r-- | Procfile | 2 | ||||
| -rw-r--r-- | config/database.yml.docker | 15 | ||||
| -rw-r--r-- | docker-compose.yml | 28 |
4 files changed, 66 insertions, 1 deletions
diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..44e35277 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM ruby:2.4 +MAINTAINER mo@mokhan.ca + +RUN apt-get update && apt-get install -y \ + build-essential \ + libpq-dev \ + libxml2-dev \ + libxslt1-dev \ + unzip \ + vim \ + postgresql-client +RUN curl -sL https://deb.nodesource.com/setup_4.x | bash - +RUN apt-get install -y nodejs +RUN npm install npm -g +RUN npm install phantomjs-prebuilt -g + +RUN mkdir -p /app +WORKDIR /app + +ADD Gemfile* ./ +RUN gem install bundler && bundle install --jobs 4 +ADD . ./ @@ -1,2 +1,2 @@ worker: bundle exec rake jobs:work -web: bundle exec rails server +web: bundle exec rails server -b 0.0.0.0 diff --git a/config/database.yml.docker b/config/database.yml.docker new file mode 100644 index 00000000..6df3d448 --- /dev/null +++ b/config/database.yml.docker @@ -0,0 +1,15 @@ +default: &default + adapter: postgresql + encoding: unicode + pool: 5 + username: postgres + password: + host: db + +development: + <<: *default + database: development + +test: + <<: *default + database: test diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..33d7bef3 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,28 @@ +version: '2' +services: + web: + build: . + command: bundle exec foreman start web + ports: + - "3000:3000" + volumes: + - .:/app + links: + - redis + - db + depends_on: + - redis + - db + environment: + - REDIS_URL=redis://redis:6379/12 + - RAILS_LOG_TO_STDOUT=true + db: + image: postgres:latest + ports: + - "5432:5432" + volumes: + - ./db/data:/var/lib/postgresql/data + redis: + image: redis:latest + ports: + - "6379:6379" |
