Skip to content

Instantly share code, notes, and snippets.

@JulienBreux
Created February 10, 2015 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JulienBreux/ad1a15ef8b3133a3830c to your computer and use it in GitHub Desktop.
Save JulienBreux/ad1a15ef8b3133a3830c to your computer and use it in GitHub Desktop.
Docker + Rails + Redis + Postgres
# base on latest ruby base image
FROM ruby:latest
# update and install dependencies
RUN apt-get update -qq
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential libpq-dev nodejs apt-utils postgresql-client
# setup app folders
RUN mkdir /sample
WORKDIR /sample
# copy over Gemfile and install bundle
ADD Gemfile /sample/Gemfile
ADD Gemfile.lock /sample/Gemfile.lock
RUN bundle install
# copy over remaining app files
ADD . /sample
# Run
EXPOSE 3000
CMD ["rails", "server"]
db:
image: postgres:9.4
ports:
- "5432"
redis:
image: redis:2.8.19
ports:
- 6379:6379
web:
build: .
#command: bundle exec rails server -p 3000
command: bundle exec unicorn -p 3000 -c ./config/unicorn.rb
volumes:
- .:/sample
ports:
- 3000:3000
links:
- db
- redis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment