Skip to content

Instantly share code, notes, and snippets.

@grantspeelman
Created March 15, 2017 19:31
Show Gist options
  • Save grantspeelman/9c67d3c89400a2ceef703cefe893d780 to your computer and use it in GitHub Desktop.
Save grantspeelman/9c67d3c89400a2ceef703cefe893d780 to your computer and use it in GitHub Desktop.
Ruby on Rails development with docker-compose, spring and PostgreSQL
version: '2'
volumes:
postgres-data:
driver: local
services:
db:
image: postgres
volumes:
- postgres-data:/var/lib/postgresql/data
spring:
build: .
volumes:
- .:/usr/src/app
command: bundle exec spring server
pid: host
web:
build: .
command: bundle exec puma -b 'tcp://0.0.0.0:3000'
volumes:
- .:/usr/src/app
ports:
- "3000:3000"
depends_on:
- db
# 1: Use ruby 2.3.3 as base:
FROM ruby:2.3.3
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev
# 2: We'll set the application path as the working directory
WORKDIR /usr/src/app
# 3: We'll set the working dir as HOME and add the app's binaries path to $PATH:
ENV HOME=/usr/src/app PATH=/usr/src/app/bin:$PATH
# 7: Install the current project gems - they can be safely changed later during
# development via `bundle install` or `bundle update`:
ADD Gemfile* /usr/src/app/
RUN set -ex && bundle install --jobs 2 --retry 3 --clean
@grantspeelman
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment