-
-
Save brazenbraden/b4ef6839ac81fdd42a4a to your computer and use it in GitHub Desktop.
Provisioning rails app in docker
This file contains 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.5 | |
container_name: postgres | |
ports: | |
- "5432:5432" | |
environment: | |
- POSTGRES_PASSWORD=root | |
web: | |
build: . | |
container_name: rails | |
command: rails s -b 0.0.0.0 | |
volumes: | |
- .:/app | |
ports: | |
- "3000:3000" | |
links: | |
- db | |
environment: | |
- DEBUG=true | |
- RAILS_ENV=development |
This file contains 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.3 | |
RUN apt-get update && apt-get install -y nodejs build-essential libpq-dev imagemagick libmagickwand-dev --no-install-recommends && rm -rf /var/lib/apt/lists/* | |
# Setup working directory | |
RUN mkdir -p /app | |
WORKDIR /app | |
COPY . ./ | |
VOLUME /app | |
# Install gems | |
RUN bundle install --local --path vendor/bundle/ |
This file contains 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
vagrant@vagrant-ubuntu-trusty-64:~$ docker logs rails | |
/app/vendor/bundle/ruby/2.2.0/gems/pg-0.18.3/lib/pg.rb:4:in `require': libruby.so.2.2: cannot open shared object file: No such file or directory - /app/vendor/bundle/ruby/2.2.0/gems/pg-0.18.3/lib/pg_ext.so (LoadError) | |
from /app/vendor/bundle/ruby/2.2.0/gems/pg-0.18.3/lib/pg.rb:4:in `<top (required)>' | |
from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require' | |
from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require' | |
from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each' | |
from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require' | |
from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each' | |
from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require' | |
from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler.rb:134:in `require' | |
from /app/config/application.rb:8:in `<top (required)>' | |
from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:78:in `require' | |
from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:78:in `block in server' | |
from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `tap' | |
from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `server' | |
from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!' | |
from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>' | |
from bin/rails:4:in `require' | |
from bin/rails:4:in `<main>' |
This file contains 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' | |
ruby '2.2.2' | |
gem 'rails', '4.2.4' | |
gem 'mysql2', '0.4.1', platforms: :ruby | |
gem 'activerecord-session_store', github: 'rails/activerecord-session_store' | |
group :production do | |
gem 'therubyracer', platforms: :ruby | |
gem 'rails_12factor' | |
gem 'unicorn' | |
gem 'capistrano' | |
end | |
gem 'devise' | |
gem 'omniauth-facebook' | |
gem 'simple_form' | |
gem 'cocoon' | |
gem 'sidekiq' | |
gem 'apostle-rails' # apostle.io integration | |
gem 'gibbon' # mailchimp integration | |
gem 'mixpanel-ruby' # mixpanel integration | |
gem 'rest-client' # required for hiveage | |
gem 'haml-rails' | |
gem 'sass-rails', '~> 4.0.0' | |
gem 'compass-rails' | |
gem 'uglifier', '>= 1.3.0' | |
gem 'redcarpet' | |
gem 'remotipart' | |
gem 'mini_magick' | |
gem 'carrierwave' | |
gem 'figaro' | |
gem 'whenever', require: false # for setting up cronjobs | |
group :development do | |
gem 'quiet_assets' | |
gem 'awesome_print' | |
gem 'better_errors' | |
gem 'binding_of_caller' | |
end |
This file contains 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
Vagrant.configure(2) do |config| | |
config.vm.box = 'ubuntu/trusty64' | |
config.vm.box_check_update = false | |
config.vm.network :private_network, ip: '10.0.0.40' | |
unless Vagrant.has_plugin?('vagrant-docker-compose') | |
raise 'vagrant-docker-compose is not installed! Please run: vagrant plugin install vagrant-docker-compose' | |
end | |
config.vm.provider 'virtualbox' do |v| | |
v.name = 'jugglebee' | |
v.customize ['modifyvm', :id, '--natdnshostresolver1', 'on'] | |
v.customize ['modifyvm', :id, '--natdnsproxy1', 'on'] | |
v.check_guest_additions = false | |
v.functional_vboxsf = false | |
v.gui = false | |
v.memory = 2048 | |
v.cpus = 1 | |
end | |
config.vm.synced_folder '.', '/app', type: 'nfs' | |
config.vm.provision :docker | |
config.vm.provision :docker_compose, yml: '/app/docker-compose.yml', run: 'always', rebuild: true | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment