Commit 2cfe2d7a authored by Terence Lee's avatar Terence Lee

fix rake shell and add rake server

* move spec docker things into spec/support/docker/
* rake shell now copies src files into /app/ and generates nginx.conf
* rake server[fixture] will now boot an nginx server locally
parent a0c73149
...@@ -5,6 +5,27 @@ task :shell, [:fixture] do |t, args| ...@@ -5,6 +5,27 @@ task :shell, [:fixture] do |t, args|
include PathHelper include PathHelper
BuildpackBuilder.new(@debug) BuildpackBuilder.new(@debug)
fixture_path = File.expand_path(fixtures_path(args[:fixture])) fixture_path = File.expand_path(fixtures_path(args[:fixture]))
system("docker run -i -v #{fixture_path}:/src -t #{BuildpackBuilder::TAG} \"bash\"") cmd = %Q{docker run -i -v #{fixture_path}:/src -t #{BuildpackBuilder::TAG} /bin/bash -c "/app/bin/config/make-config && bash"}
puts cmd
system cmd
end
task :server, [:fixture] do |t, args|
require_relative "spec/support/buildpack_builder"
require_relative "spec/support/app_runner"
debug = true
thread_name = :app_thread
Signal.trap("INT") do
Thread.list.detect {|thread| thread[:name] == thread_name }.wakeup
end
BuildpackBuilder.new(debug)
app = AppRunner.new(args[:fixture], {}, debug)
app.run do
Thread.current[:name] = thread_name
Thread.stop
end
end end
...@@ -24,6 +24,6 @@ class BuildpackBuilder ...@@ -24,6 +24,6 @@ class BuildpackBuilder
-> (chunk) { nil } -> (chunk) { nil }
end end
Docker::Image.build_from_dir(buildpack_path.to_s, 't' => TAG, 'rm' => true, &print_output) Docker::Image.build_from_dir(buildpack_path.to_s, 't' => TAG, 'rm' => true, 'dockerfile' => "spec/support/docker/Dockerfile", &print_output)
end end
end end
...@@ -13,3 +13,6 @@ ENV PORT 3000 ...@@ -13,3 +13,6 @@ ENV PORT 3000
EXPOSE 3000 EXPOSE 3000
WORKDIR /app WORKDIR /app
COPY ./spec/support/docker/init.sh /usr/bin/init.sh
ENTRYPOINT ["/usr/bin/init.sh"]
#!/bin/bash
cp -rf /src/* /app/
exec "$@"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment