This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Add Docker-specific rake tasks (#857)

* Add Docker-specific rake tasks
- Prevent conflicts with non-Docker setups

* Add :docker namespace
update non-docker task to be more rubyesque

* remove brew from docker dev bootstrap rake task

* Update dockerfile to use new docker namespace

* Add -o 0.0.0.0 to local dev for proper mapping

* use long-form parameter names instead of short
  • Loading branch information...
taquitos committed May 14, 2018
1 parent 12fac6d commit be0f2badc15d58217a274dee1fb53e93ec77bd1e
Showing with 27 additions and 9 deletions.
  1. +1 −1 Dockerfile
  2. +1 −1 README.md
  3. +25 −7 Rakefile
View
@@ -11,6 +11,6 @@ COPY Gemfile Gemfile.lock Rakefile ./
COPY . .
RUN bundle install
CMD ["hosted_prod_test"]
CMD ["docker:prod_test"]
ENTRYPOINT ["bundle", "exec", "rake"]
EXPOSE 8080
View
@@ -84,7 +84,7 @@ Currently, Docker deployment is for Linux projects only.
## Development installation
Run the rake task: `rake devbootstrap`.
Run the rake task: `rake dev_bootstrap`.
1. Install all dependencies (ruby, javascript)
2. Add a pre-commit hook
View
@@ -1,22 +1,40 @@
task :dev do
sh "bundle exec rackup -o 0.0.0.0 -p 8080 --env development"
sh "bundle exec rackup --host 0.0.0.0 --port 8080 --env development"
end
task :prod do
sh "bundle exec rackup -p 8080 --env production"
sh "bundle exec rackup --host 0.0.0.0 --port 8080 --env production"
end
task :hosted_prod_test do
sh("FASTLANE_CI_ERB_CLIENT=1 DEBUG=1 FASTLANE_CI_DISABLE_REMOTE_STATUS_UPDATE=1 FASTLANE_CI_DISABLE_PUSHES=1 FASTLANE_CI_SKIP_RESTARTING_PENDING_WORK=1 bundle exec rackup --host 0.0.0.0 -p 8080 --env development")
end
task :devbootstrap do
task :dev_bootstrap do
sh("bundle install")
sh("brew install node") unless sh("npm -v")
sh("npm install")
sh("ln -sf ../../.pre-commit .git/hooks/pre-commit")
end
# It seems like mapping ports in Docker requires --host which can break hosting in VMs
# So we'll just keep some docker-specific tasks down here
namespace :docker do
desc "Run in a Docker container in production mode"
task :prod do
sh "bundle exec rackup --host 0.0.0.0 --port 8080 --env production"
end
desc "Run in a Docker container with debugging on, no pushes, and no restarting work to help test config stuff"
task :prod_test do
# rubocop:disable Metrics/LineLength
sh("FASTLANE_CI_ERB_CLIENT=1 DEBUG=1 FASTLANE_CI_DISABLE_REMOTE_STATUS_UPDATE=1 FASTLANE_CI_DISABLE_PUSHES=1 FASTLANE_CI_SKIP_RESTARTING_PENDING_WORK=1 bundle exec rackup --host 0.0.0.0 --port 8080 --env development")
# rubocop:enable Metrics/LineLength
end
desc "Bootstrap for running in a Docker container"
task :dev_bootstrap do
sh("bundle install")
sh("npm install")
end
end
begin
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)

0 comments on commit be0f2ba

Please sign in to comment.