Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Packer only build process #72

Closed
wants to merge 81 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
8a7507e
Using misheshka ubuntu box with built-in docker, updated readme, b2d …
Mar 1, 2014
2c32ab5
wip on new fig as binary
Mar 4, 2014
d2e52e4
Getting last version of mitchellh
Apr 21, 2014
1c15b2e
AZdding vboxsf support
Apr 21, 2014
8d18f08
Managing cases when multiple boot2docker VMs are launched
Apr 21, 2014
1a92a02
some docs
Apr 21, 2014
1450bb7
Build system for windows + Managing if a custom profile exists (corpo…
Apr 22, 2014
72f489f
updating doc
Apr 23, 2014
facfd74
[wip] Adding bats install, a basic bats test and implementing box tes…
Apr 23, 2014
ad90188
Correcting cases when vagrant-cachier does not exists
Apr 23, 2014
419fee1
[changelog] Implementing tests with bats on Windows scripts
Apr 23, 2014
fac2477
Merge branch 'develop'
Apr 23, 2014
c1077ef
readme update
Apr 23, 2014
8310240
Chang gitgnore
dduportal Apr 27, 2014
28e5408
Headless activation
dduportal Apr 27, 2014
37034ac
No need for the build-iso script now
dduportal May 7, 2014
752042b
We don't need to track any iso
dduportal May 7, 2014
e6fc186
Adding auto_correct to NAT rule for docker daemon
dduportal May 7, 2014
c044cc0
Moving packer virtualbox provider to headless for IC build
dduportal May 7, 2014
c9a4cf9
Moving box build to official b2 build ans using vagrant 1.6 brand new…
dduportal May 7, 2014
b047cab
Adding version constraint to README + updating build process
dduportal May 7, 2014
9b410dc
merge docker-build
dduportal May 7, 2014
061ea98
Updating windows batch script to the new docker build system
dduportal May 7, 2014
c56efe5
Adding a linux build based system and correcting windows based
dduportal May 7, 2014
2f7d453
Adding virtualbox capability in the build system
dduportal May 7, 2014
d260529
doc update
dduportal May 7, 2014
4e15982
Doc update
dduportal May 8, 2014
16af33b
Add the latest docker version when building
dduportal May 14, 2014
4844352
[wip] working on docker 0.9.0 integration
dduportal May 15, 2014
9c0caeb
A big bunch opf changes, see changelog for infos
dduportal Jun 15, 2014
0faf2b0
merge to develop due to human errore : i need to sleep :-)
dduportal Jun 15, 2014
3c97002
Correcting build workflow
dduportal Jun 15, 2014
f2f2922
Minor corrections
dduportal Jun 15, 2014
b0e344b
Little change in build scripts for increments builds
dduportal Jun 15, 2014
60c1f65
No longer run bats tests under windows
dduportal Jun 15, 2014
c1382c2
Disabling the -l option of sh while it make impossible the machine.co…
dduportal Jun 15, 2014
bb1fb33
Adapting bats tests under linux
dduportal Jun 15, 2014
973c81d
Fix typos
Laurent-Sarrazin Jun 17, 2014
6952fc0
Merge pull request #1 from Laurent-Sarrazin/master
dduportal Jun 18, 2014
dc1d9f7
edit changelog for future version
dduportal Jun 19, 2014
15fa644
Changelog
dduportal Jun 19, 2014
ea9628d
[WIP] Moving to a global vagrantfile using boot2docker lightweight im…
dduportal Jun 19, 2014
b93d9f5
[Wip] A working all-in-one Dockerfile with context
dduportal Jun 19, 2014
f845708
[wip] wooops, forgot the vagrant-rc-script
dduportal Jun 19, 2014
4fd062a
[wip] Adapting workflow (iso naming)
dduportal Jun 19, 2014
a6fc422
Cleaning b2d-vbox
dduportal Jun 19, 2014
7eb4490
[wip] Edit build workflow to add possibility of building the boot2doc…
dduportal Jun 19, 2014
a635d11
[changelog] we can build from orig image
dduportal Jun 19, 2014
94d6790
Preapring release
dduportal Jun 19, 2014
c9d102c
typo
dduportal Jun 19, 2014
be5d272
release 1.0.0
dduportal Jun 19, 2014
6410a9e
Release note @ changelog
dduportal Jul 3, 2014
64d00ef
[changelog] error handling when vagrant start to yell out
dduportal Jul 4, 2014
f4f5b53
Changelog for release 1.1.0
dduportal Jul 5, 2014
9015e36
[changelog] persisting b2d dependency
dduportal Jul 13, 2014
0a7fb46
[changelog] cleaning unused (not tested => not used) providers and mo…
dduportal Jul 13, 2014
09f0a65
changelog update
dduportal Jul 13, 2014
7310cb8
[changelog] Moving to b2d 1.1.2
Jul 28, 2014
de6263c
[changelog] Moving to vbox 4.3.14
Jul 28, 2014
dcf7f3f
Moving to b2d 1.2.0
dduportal Aug 23, 2014
eafc12c
upgrade with new boot2docker image (docker 1.3)
Oct 31, 2014
97d7169
Enabling the default vagrant share while boot2docker 1.3.0 embed vbox…
dduportal Nov 4, 2014
499d4c7
Ignore packer output dirs
dduportal Nov 4, 2014
9e532ee
Disabling parallels additions for packer 0.7.x compatibility
dduportal Nov 4, 2014
349ace9
Merge branch 'vboxsf_enabled' into new-master
dduportal Nov 4, 2014
0e7011f
Merge pull request #4 from pouicr/upgrade-docker1.3
dduportal Nov 4, 2014
d47f3e3
Adding docker SSL tcp port
dduportal Nov 5, 2014
5040ef3
merge add ssl docker port
dduportal Nov 5, 2014
f46ad29
While vagrant can insert its own ssh keys and will generate news in v…
dduportal Nov 5, 2014
38d7455
Simplifying the whole build process
dduportal Nov 5, 2014
b319dc7
Moving to a packer-only build process using a shell script + correcti…
dduportal Nov 6, 2014
c77be02
Forgot some files for packer only build
dduportal Nov 6, 2014
55bb697
Inserting the ssh key of vagrant using the userdata function of boot2…
dduportal Nov 6, 2014
316f351
revert a forgotten change which is not needed
dduportal Nov 6, 2014
3b83a23
Merge new build process based only on packer
dduportal Nov 7, 2014
ec87932
Merge new build process based only on packer - part 2
dduportal Nov 7, 2014
5b76b3b
Correctin merge errors - im a dumb
dduportal Nov 7, 2014
38552d7
README update
dduportal Nov 7, 2014
8a70f67
Updating forgotten unmerged conflicts
dduportal Nov 7, 2014
200401a
Some changelog updates
dduportal Nov 7, 2014
7c478d9
typo
dduportal Nov 7, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
.vagrant/
packer_cache/
*.box
b2d.iso
boot2docker-vagrant.iso
*.iso
output*
61 changes: 61 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

## 07/11/2014 (v1.3.1)
- Moving to boot2docker 1.3.1 (docker 1.3.1)
- Adding SSL docker's daemon port NAT to 2376
- NATed ports are now auto-moved when conflicting
- Packer 0.7 compatibility
- When docker-building, AUFS limit is now 128 layers instead of 42
- Packer-only new build process, from the vanilla boot2docker iso, checksumed

## 13/07/2014 (v1.1.1)
- Moving to boot2docker 1.1.1 (and Docker 1.1.1 by transitivity)
- Persisting the b2d dependency into the make.sh script for easying future updates and trusting
- Moving the default RAM of the VM to 2Gb

## 05/07/2014 (v1.1.0)
- Moving to docker v1.1.0
- Moving to boot2docker v1.1.0
- Adding some error handling when building from shell

## 22/06/2014 (v1.0.1)
- Moving to docker and b2d 1.0.1

## 19/06/2014 (v1.0.0)
- Building b2d-vbox and b2d vagrant custom in one Dockerfile instead of Docker + vagrant + ubuntu
- Adding possibility to build boot2docker vanilla image from official github repo instead of pulling from Docker index
- Move to b2d and docker 1.0.0 (bash make.sh v1.0.0)

## 15/06/2014 (v0.5.0)
- Moving to the new IANA Docker port 2375, and let vagrant auto corrects when collision
- Moving to boot2docker and Docker 1.0.0
- Using a custom Vagrantfile for building a b2d iso with vbox addition
- Re-using temporarly mitchellh vagrantfile + build-iso workflow for "vagranti-zing" the b2d.iso
- Updating build scripts (Unix/Windows) with packer building all types

## 08/05/2014 (v0.4.0)
- Adding auto Docker update
- Moving to Docker 0.11.1

## 07/05/2014 (v0.3.0)
- Adding linux build chain and bats tests
- Moving to official boot2docker build system
- Integrate boot2docker build into a Vagrant Docker provider
- Vboxsf build into ISO (auto) [4.3.8]

## 23/04/2014 (v0.2.0)
- Adding custom_profile mangement
- Adding Windows build chain
- Adding docker and vagrant BATS tests, Windows only

## 21/04/2014 (v0.1.0)

- Fetching latest version from mitchellh offical repository (results in using a vagrant cloud baebox with no docker)
- Updating b2d to experimental build with vboxsf inside (https://github.com/boot2docker/boot2docker/issues/282)
- Updating build-iso.sh to add a /etc/rc.d script for loading vboxsf module at boot.
- Updating basebox's vagrantfile template to enable /vagrant share
- Updating basebox's vagrantfile template to aut correct docker's TCP port when launching multiple VMs

## 03/03/2014

- Using misheska's ubuntu basebox for running docker easily.
- Attempts to install fig from orchardups.
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ build: boot2docker-vagrant.iso
prepare: clean boot2docker-vagrant.iso

boot2docker-vagrant.iso:
vagrant up
vagrant ssh -c 'cd /vagrant && sudo ./build-iso.sh'
vagrant destroy --force
wget -O boot2docker.iso https://github.com/boot2docker/boot2docker/releases/download/v1.3.0/boot2docker.iso

clean:
rm -rf *.iso *.box
Expand Down
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# boot2docker Vagrant Box

This repository contains the scripts necessary to create a Vagrant-compatible
[boot2docker](https://github.com/steeve/boot2docker) box. If you work solely
[boot2docker](https://github.com/boot2docker/boot2docker) box. If you work solely
with Docker, this box lets you keep your Vagrant workflow and work in the
most minimal Docker environment possible.

Expand Down Expand Up @@ -32,22 +32,18 @@ do so in seconds.

To build the box, first install the following prerequisites:

* [Packer](http://www.packer.io) (at least version 0.5.1)
* [Packer](http://www.packer.io) (at least version 0.7.2)
* [VirtualBox](http://www.virtualbox.org) (at least version 4.3), VMware, or Parallels
* [Vagrant](http://www.vagrantup.com)

Then follow the steps:

```
$ vagrant up
...
$ vagrant ssh -c 'cd /vagrant && sudo ./build-iso.sh'
...
$ vagrant destroy --force
$ wget -O boot2docker-vagrant.iso <latest ISO release of boot2docker>
...
$ packer build template.json
...
```

You can restrict only VirtualBox, VMware, or Parallels by specifying the `-only` flag
to Packer.
to Packer.
23 changes: 0 additions & 23 deletions Vagrantfile

This file was deleted.

32 changes: 32 additions & 0 deletions b2d-provision.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh

# Creating one partition and formating to ext4
# See https://github.com/boot2docker/boot2docker/issues/531#issuecomment-61740859
echo "n
p
1


w
p
q
"| /sbin/fdisk /dev/sda
/sbin/mkfs.ext4 -L boot2docker-data /dev/sda1

# Mounting the freshly formatted volume to copy persisted content
mount /dev/sda1 /mnt

# Inserting vagrant key in the userdata.tar which should be deployed when boot2docker boot
B2D_PERSISTENT_DIR=/mnt/var/lib/boot2docker
TMP_USERDATA_DIR=/tmp/userdata

mkdir -p ${B2D_PERSISTENT_DIR} ${TMP_USERDATA_DIR}/.ssh

cat <<KEY >${TMP_USERDATA_DIR}/.ssh/authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key
KEY
chmod 0600 ${TMP_USERDATA_DIR}/.ssh/authorized_keys


cd ${TMP_USERDATA_DIR}
tar cf ${B2D_PERSISTENT_DIR}/userdata.tar ./.ssh
73 changes: 0 additions & 73 deletions build-iso.sh

This file was deleted.

Binary file removed readme_image.gif
Binary file not shown.
43 changes: 27 additions & 16 deletions template.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
{
"variables": {
"B2D_ISO_FILE": "boot2docker.iso",
"B2D_ISO_CHECKSUM": "a0f8e7b9ef9a59befcd9ceff604ef2af"
},
"builders": [{
"type": "virtualbox-iso",
"iso_url": "boot2docker-vagrant.iso",
"iso_checksum_type": "none",
"iso_url": "{{user `B2D_ISO_FILE`}}",
"iso_checksum_type": "md5",
"iso_checksum": "{{user `B2D_ISO_CHECKSUM`}}",
"boot_wait": "5s",
"guest_additions_mode": "attach",
"guest_os_type": "Linux_64",
Expand All @@ -11,33 +16,39 @@
"shutdown_command": "sudo poweroff"
}, {
"type": "vmware-iso",
"iso_url": "boot2docker-vagrant.iso",
"iso_checksum_type": "none",
"iso_url": "{{user `B2D_ISO_FILE`}}",
"iso_checksum_type": "md5",
"iso_checksum": "{{user `B2D_ISO_CHECKSUM`}}",
"boot_wait": "5s",
"guest_os_type": "other3xlinux-64",
"ssh_username": "docker",
"ssh_password": "tcuser",
"shutdown_command": "sudo poweroff"
}, {
"type": "parallels-iso",
"iso_url": "boot2docker-vagrant.iso",
"iso_checksum_type": "none",
"iso_url": "{{user `B2D_ISO_FILE`}}",
"iso_checksum_type": "md5",
"iso_checksum": "{{user `B2D_ISO_CHECKSUM`}}",
"boot_wait": "5s",
"guest_os_distribution": "linux",
"guest_os_type": "linux",
"ssh_username": "docker",
"ssh_password": "tcuser",
"shutdown_command": "sudo poweroff"
}],

"provisioners": [{
"type": "shell",
"inline": ["mkfs.ext4 -F -L boot2docker-data /dev/sda"]
"shutdown_command": "sudo poweroff",
"parallels_tools_mode": "disable"
}],

"provisioners": [
{
"type": "shell",
"execute_command": "{{ .Vars }} sudo -E -S sh '{{ .Path }}'",
"scripts": [
"b2d-provision.sh"
]
}
],
"post-processors": [{
"type": "vagrant",
"include": ["boot2docker-vagrant.iso"],
"include": ["boot2docker.iso"],
"vagrantfile_template": "vagrantfile.tpl",
"output": "boot2docker_{{.Provider}}.box"
}]
}
}
14 changes: 6 additions & 8 deletions vagrantfile.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ Vagrant.configure("2") do |config|
config.ssh.shell = "sh"
config.ssh.username = "docker"

# Disable synced folders because guest additions aren't available
config.vm.synced_folder ".", "/vagrant", disabled: true

# Expose the Docker port
# Expose the Docker ports (non secured AND secured)
config.vm.network "forwarded_port", guest: 2375, host: 2375, host_ip: "127.0.0.1", auto_correct: true, id: "docker"
config.vm.network "forwarded_port", guest: 2376, host: 2376, host_ip: "127.0.0.1", auto_correct: true, id: "docker-ssl"

# Attach the ISO
config.vm.provider "virtualbox" do |v|
Expand All @@ -16,15 +14,15 @@ Vagrant.configure("2") do |config|
"--port", "0",
"--device", "1",
"--type", "dvddrive",
"--medium", File.expand_path("../boot2docker-vagrant.iso", __FILE__),
"--medium", File.expand_path("../boot2docker.iso", __FILE__),
]
end

["vmware_fusion", "vmware_workstation"].each do |vmware|
config.vm.provider vmware do |v|
v.vmx["bios.bootOrder"] = "CDROM,hdd"
v.vmx["ide1:0.present"] = "TRUE"
v.vmx["ide1:0.fileName"] = File.expand_path("../boot2docker-vagrant.iso", __FILE__)
v.vmx["ide1:0.fileName"] = File.expand_path("../boot2docker.iso", __FILE__)
v.vmx["ide1:0.deviceType"] = "cdrom-image"
end
end
Expand All @@ -34,11 +32,11 @@ Vagrant.configure("2") do |config|
"set", :id,
"--device-add", "cdrom",
"--enable", "--connect",
"--image", File.expand_path("../boot2docker-vagrant.iso", __FILE__)
"--image", File.expand_path("../boot2docker.iso", __FILE__)
]
v.customize "pre-boot", [
"set", :id,
"--device-bootorder", "cdrom0 hdd0"
]
end
end
end