Last active
January 21, 2016 14:11
-
-
Save wwwbruno/b5cb5c4b05d03d605b83 to your computer and use it in GitHub Desktop.
Dockerfile and docker-compose.yml for Rails Application
This file contains hidden or 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
db: | |
image: postgres:9.4.4 | |
web: | |
build: . | |
command: bundle exec rails s -p 3000 -b '0.0.0.0' | |
volumes: | |
- .:/myapp | |
ports: | |
- "3000:3000" | |
links: | |
- db |
This file contains hidden or 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
FROM ruby:2.2.1 | |
RUN apt-get update -qq && apt-get install -y build-essential | |
# for postgres | |
RUN apt-get install -y libpq-dev | |
# for capybara-webkit | |
RUN apt-get install -y libqt4-webkit libqt4-dev xvfb | |
# for a JS runtime | |
RUN apt-get install -y nodejs | |
RUN mkdir /myapp | |
WORKDIR /myapp | |
ADD Gemfile /myapp/Gemfile | |
ADD Gemfile.lock /myapp/Gemfile.lock | |
RUN bundle install | |
ADD . /myapp |
This file contains hidden or 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
# build the container | |
docker-compose build | |
# setup the database | |
docker-compose run web rake db:setup | |
# run the application | |
docker-compose up | |
# open on your browser | |
# http://DOCKER_VM_IP:3000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment