Skip to content
This repository was archived by the owner on Oct 21, 2024. It is now read-only.

Commit 1c02605

Browse files
committed
basic rake task for building the vagrant box
1 parent ed523c7 commit 1c02605

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

Rakefile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
require 'tmpdir'
2+
require 'json'
3+
require 'aws-sdk-v1'
4+
5+
REPO = "git@github.com:dduportal/boot2docker-vagrant-box.git"
6+
BUCKET = "instructure-engineering"
7+
S3_PATH = "vagrant-images/"
8+
9+
task 'default' => 'build-vagrant-box'
10+
11+
task 'build-vagrant-box' do
12+
s3 = AWS::S3.new.buckets[BUCKET]
13+
# make sure we have S3 creds, so we don't find out way later
14+
s3.objects.with_prefix(S3_PATH).count
15+
16+
Dir.mktmpdir do |dir|
17+
Dir.chdir(dir)
18+
system("git clone #{REPO} vagrant-box")
19+
Dir.chdir("vagrant-box")
20+
# need a better way to determine version
21+
File.read("Makefile").match(%r{releases/download/v([\d.]+)/boot2docker})
22+
box_version = $1
23+
if box_version.nil?
24+
raise("couldn't determine the box version from Makefile")
25+
end
26+
# remove the parallels build, since I don't have parallels available
27+
template = JSON.parse(File.read("template.json"))
28+
template["builders"].delete_if { |builder| builder['type'] == 'parallels-iso' }
29+
File.open("template.json", "wb") { |f| f.write(JSON.generate(template)) }
30+
system("make")
31+
32+
%w[vmware virtualbox].each do |box_type|
33+
obj_name = "boot2docker_#{box_type}_#{box_version}.box"
34+
obj = s3.objects[S3_PATH+obj_name]
35+
obj.write(file: "boot2docker_#{box_type}.box",
36+
acl: :public_read)
37+
puts "https://s3.amazonaws.com/#{BUCKET}/#{S3_PATH}#{obj_name}"
38+
end
39+
40+
# TODO: update vagrant cloud (aka atlas) automatically
41+
puts "use the paths above to update vagrant cloud https://vagrantcloud.com/codekitchen/boxes/boot2docker"
42+
end
43+
end

0 commit comments

Comments
 (0)