Skip to content

Instantly share code, notes, and snippets.

@udkumar
Forked from JulienBreux/Dockerfile
Created November 20, 2020 03:13
Show Gist options
  • Save udkumar/4c0aa11fddc6c77cd5b3142b1fcb7ec2 to your computer and use it in GitHub Desktop.
Save udkumar/4c0aa11fddc6c77cd5b3142b1fcb7ec2 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