Skip to content

Commit

Permalink
Use a local docker-machine binary instead of the system one
Browse files Browse the repository at this point in the history
  • Loading branch information
lmakarov committed Apr 14, 2016
1 parent f3987a7 commit ff1f714
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.DS_Store
.vagrant/
.vagrant
*.box
*.iso
tests
!tests/boot2docker_vagrant_virtualbox.bats
!tests/Vagrantfile.template
/tests
!/tests/boot2docker_vagrant_virtualbox.bats
!/tests/Vagrantfile.template
/docker-machine
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@ all: docker-machine clean boot2docker.iso build test

build:
# Create and alter a B2B VM.
docker-machine create --driver=virtualbox --virtualbox-boot2docker-url=file://`pwd`/boot2docker.iso $(MACHINE_NAME)
./docker-machine create --driver=virtualbox --virtualbox-boot2docker-url=file://`pwd`/boot2docker.iso $(MACHINE_NAME)
# Download docker-compose to permanent storage.
docker-machine ssh $(MACHINE_NAME) 'sudo curl -L https://github.com/docker/compose/releases/download/$(DOCKER_COMPOSE_VERSION)/docker-compose-`uname -s`-`uname -m` --create-dirs -o /var/lib/boot2docker/bin/docker-compose'
./docker-machine ssh $(MACHINE_NAME) 'sudo curl -L https://github.com/docker/compose/releases/download/$(DOCKER_COMPOSE_VERSION)/docker-compose-`uname -s`-`uname -m` --create-dirs -o /var/lib/boot2docker/bin/docker-compose'
# Run provisioning script.
docker-machine ssh $(MACHINE_NAME) < scripts/provision.sh
./docker-machine ssh $(MACHINE_NAME) < scripts/provision.sh
# Restart VM to apply settings.
docker-machine restart $(MACHINE_NAME)
./docker-machine restart $(MACHINE_NAME)
# Detach boot2docker.iso from the VM.
VBoxManage storageattach $(MACHINE_NAME) --storagectl SATA --port 0 --device 0 --medium emptydrive --forceunmount
# Export VM into a Vagrant base box.
vagrant package --base $(MACHINE_NAME) --vagrantfile Vagrantfile --include boot2docker.iso --output boot2docker_virtualbox.box
# Remove VM
docker-machine rm -f $(MACHINE_NAME)
./docker-machine rm -f $(MACHINE_NAME)

docker-machine:
# Install the specific docker-machine version
curl -L https://github.com/docker/machine/releases/download/v$(DOCKER_MACHINE_VERSION)/docker-machine-`uname -s`-`uname -m` >/usr/local/bin/docker-machine && \
chmod +x /usr/local/bin/docker-machine
curl -L https://github.com/docker/machine/releases/download/v$(DOCKER_MACHINE_VERSION)/docker-machine-`uname -s`-`uname -m` -o docker-machine && \
chmod +x docker-machine

boot2docker.iso:
curl -L https://github.com/boot2docker/boot2docker/releases/download/v$(BOOT2DOCKER_VERSION)/boot2docker.iso -o boot2docker.iso
Expand All @@ -38,7 +38,7 @@ test:
bats --tap *.bats

clean:
rm -rf *.iso *.box
docker-machine rm -f $(MACHINE_NAME) || true
rm -rf *.iso *.box

.PHONY: clean build test all

0 comments on commit ff1f714

Please sign in to comment.