mirror of
https://github.com/sunaku/tamzen-font.git
synced 2024-09-11 11:55:40 +03:00
docker: mount pwd to run directly; no more copying
This commit is contained in:
parent
76f91b0d28
commit
ce1a5d8cec
25
Rakefile
25
Rakefile
@ -24,29 +24,14 @@ task 'docker:image' => %w[ Dockerfile Gemfile Gemfile.lock ] do |t|
|
|||||||
end
|
end
|
||||||
|
|
||||||
task 'docker:container' => 'docker:image' do
|
task 'docker:container' => 'docker:image' do
|
||||||
container = `
|
sh 'docker', 'run',
|
||||||
docker create \
|
'-v', "#{Dir.pwd.shellescape}:/opt",
|
||||||
-v #{Dir.pwd.shellescape}:/run/input #{DOCKER_IMAGE} \
|
'--rm', '-it', DOCKER_IMAGE,
|
||||||
sleep infinity
|
'rake', 'docker:exec', "CHOWN=#{Process.euid}:#{Process.egid}"
|
||||||
`.chomp
|
|
||||||
raise unless $?.success?
|
|
||||||
|
|
||||||
begin
|
|
||||||
sh 'docker', 'start', container
|
|
||||||
sh 'docker', 'exec', container,
|
|
||||||
'rake', '-f', '/run/input/Rakefile', 'docker:exec'
|
|
||||||
sh 'docker', 'cp', "#{container}:/opt", '_build'
|
|
||||||
ensure
|
|
||||||
sh 'docker', 'rm', '-f', container
|
|
||||||
end
|
|
||||||
|
|
||||||
sh 'rsync', '-auv', '_build/', './', '--exclude=_build'
|
|
||||||
end
|
end
|
||||||
CLOBBER.include %w[ _build ]
|
|
||||||
|
|
||||||
task 'docker:exec' do
|
task 'docker:exec' do
|
||||||
raise unless Dir.pwd == '/opt'
|
raise unless Dir.pwd == '/opt'
|
||||||
sh 'cp', '-pRT', '/run/input', '.'
|
|
||||||
|
|
||||||
ENV['DISPLAY'] = display = ':1'
|
ENV['DISPLAY'] = display = ':1'
|
||||||
sh 'vncserver', '-SecurityTypes', 'None', display
|
sh 'vncserver', '-SecurityTypes', 'None', display
|
||||||
@ -55,6 +40,8 @@ task 'docker:exec' do
|
|||||||
ensure
|
ensure
|
||||||
system 'vncserver', '-kill', display # exits nonzero
|
system 'vncserver', '-kill', display # exits nonzero
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sh 'find', '.', '-user', 'root', '-exec', 'chown', ENV['CHOWN'], '{}', ';'
|
||||||
end
|
end
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user