Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2cfe2d7

Browse files
committedSep 15, 2015
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
1 parent a0c7314 commit 2cfe2d7

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed
 

‎Rakefile

+23-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,27 @@ task :shell, [:fixture] do |t, args|
55

66
include PathHelper
77
BuildpackBuilder.new(@debug)
8-
fixture_path = File.expand_path(fixtures_path(args[:fixture]))
9-
system("docker run -i -v #{fixture_path}:/src -t #{BuildpackBuilder::TAG} \"bash\"")
8+
fixture_path = File.expand_path(fixtures_path(args[:fixture]))
9+
cmd = %Q{docker run -i -v #{fixture_path}:/src -t #{BuildpackBuilder::TAG} /bin/bash -c "/app/bin/config/make-config && bash"}
10+
puts cmd
11+
system cmd
12+
end
13+
14+
task :server, [:fixture] do |t, args|
15+
require_relative "spec/support/buildpack_builder"
16+
require_relative "spec/support/app_runner"
17+
18+
debug = true
19+
thread_name = :app_thread
20+
21+
Signal.trap("INT") do
22+
Thread.list.detect {|thread| thread[:name] == thread_name }.wakeup
23+
end
24+
25+
BuildpackBuilder.new(debug)
26+
app = AppRunner.new(args[:fixture], {}, debug)
27+
app.run do
28+
Thread.current[:name] = thread_name
29+
Thread.stop
30+
end
1031
end

‎spec/support/buildpack_builder.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ def build_image
2424
-> (chunk) { nil }
2525
end
2626

27-
Docker::Image.build_from_dir(buildpack_path.to_s, 't' => TAG, 'rm' => true, &print_output)
27+
Docker::Image.build_from_dir(buildpack_path.to_s, 't' => TAG, 'rm' => true, 'dockerfile' => "spec/support/docker/Dockerfile", &print_output)
2828
end
2929
end

‎spec/support/docker/Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ ENV PORT 3000
1313
EXPOSE 3000
1414

1515
WORKDIR /app
16+
17+
COPY ./spec/support/docker/init.sh /usr/bin/init.sh
18+
ENTRYPOINT ["/usr/bin/init.sh"]

‎spec/support/docker/init.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
cp -rf /src/* /app/
4+
5+
exec "$@"

0 commit comments

Comments
 (0)
Please sign in to comment.