Skip to content

Added Dockerfile and docker-compose.yml to run the project on Docker environment #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM ruby:latest

COPY . .
RUN apt-get update && apt-get install -y redis-server && gem install bundler -v '2.0.1' && bundle update --bundler
Copy link

@gautamkrishnar gautamkrishnar May 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kciejek
Can we move this to separate layer. Copying entire app files before installing dependencies is not a good approach.
Please see the best practices: https://medium.com/the-code-review/docker-copy-dockerfile-best-practices-503704bee69f

Copy link

@gautamkrishnar gautamkrishnar May 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this should be the Dockerfile:

FROM ruby:latest
WORKDIR /app
COPY Gemfile Gemfile.lock ./
RUN apt-get update && apt-get install -y redis-server && gem install bundler -v '2.0.1' && bundle update --bundler
COPY . .
CMD eval 'redis-server &' && bundle install && bundle exec puma

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gautamkrishnar Pefrect, thanks.

CMD eval 'redis-server &' && bundle install && bundle exec puma



10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3'
services:
web:
build: .
ports:
- "9292:9292"
environment:
- REDIS_URL=redis://redis_db:6379
redis_db:
image: redis:3.2.8