Last active
November 8, 2018 22:36
-
-
Save Rudis1261/a8657ee684143fe92406300b1d23774c to your computer and use it in GitHub Desktop.
Rails Docker Setup
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
default: &default | |
adapter: mysql2 | |
encoding: utf8 | |
pool: 5 | |
username: root | |
password: root | |
post: 3306 | |
host: mysql | |
development: | |
<<: *default | |
database: rails-app_development |
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
version: '2' | |
services: | |
mysql: | |
image: mariadb | |
volumes: | |
- ~/Projects/database_data:/var/lib/mysql | |
environment: | |
- MYSQL_ROOT_PASSWORD=root | |
ports: | |
- "3306:3306" | |
web: | |
build: . | |
command: bundle exec rails s -e rudi -p 3000 -b '0.0.0.0' | |
volumes: | |
- .:/usr/local/rails-app | |
working_dir: /usr/local/rails-app | |
ports: | |
- "3000:3000" | |
depends_on: | |
- mysql |
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.3.1 | |
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs | |
RUN apt-get install -y imagemagick | |
RUN mkdir /usr/local/rails-app | |
WORKDIR /usr/local/rails-app | |
ADD Gemfile Gemfile | |
ADD Gemfile.lock Gemfile.lock | |
RUN bundle install |
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
source 'https://rubygems.org' | |
gem 'rails', '4.2.7.1' | |
gem 'mysql2', '~> 0.3.18' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Build it
docker-compose build
Start it up
docker-compose up
Rake it in another terminal session
docker-compose run web rails db:create