Created
March 15, 2017 19:31
-
-
Save grantspeelman/9c67d3c89400a2ceef703cefe893d780 to your computer and use it in GitHub Desktop.
Ruby on Rails development with docker-compose, spring and PostgreSQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
checkout the blog post: https://grant-ps.blog/2017/03/15/ruby-on-rails-development-with-docker-compose-spring-and-postgresql/