diff --git a/iso/.gitignore b/iso/.gitignore new file mode 100644 index 0000000000..18d35f190c --- /dev/null +++ b/iso/.gitignore @@ -0,0 +1 @@ +minikube.iso diff --git a/iso/Dockerfile b/iso/Dockerfile new file mode 100644 index 0000000000..095134941a --- /dev/null +++ b/iso/Dockerfile @@ -0,0 +1,29 @@ +# TODO: Move this to somewhere on GCR and manage tags explicitly instead of +# relying on latest. +FROM boot2docker/boot2docker + +# Set the version of Docker and the expected sha. +RUN echo "1.9.1" > $ROOTFS/etc/version +ENV DOCKER_SHA 8824f8a67fbe55d1e52dcbebc74219ba8090006e + +# Add other dependencies here to $ROOTFS/ +ADD nsenter $ROOTFS/usr/bin/ + +# Get a specific version of Docker. This will overwrite the binary installed +# in the base image. +# The --strip-components=3 flag will have to change as we switch docker versions +# past 1.10.x. They changed the packaging format slightly. +RUN rm -f /$ROOTFS/usr/local/bin/docker* +RUN curl -fSL -o /tmp/dockerbin.tgz https://get.docker.com/builds/Linux/x86_64/docker-$(cat $ROOTFS/etc/version).tgz && \ + # Check the sha1 matches. + if [ $DOCKER_SHA != $(sha1sum /tmp/dockerbin.tgz | cut -f1 -d ' ') ]; then echo "SHA mismatch!"; exit 1; fi && \ + tar -zxvf /tmp/dockerbin.tgz -C "$ROOTFS/usr/local/bin" --strip-components=3 && \ + rm /tmp/dockerbin.tgz + +RUN $ROOTFS/usr/local/bin/docker -v + +# Build the actual iso image +RUN /make_iso.sh + +# Output it to transfer back to the host +CMD ["cat", "boot2docker.iso"] diff --git a/iso/README.md b/iso/README.md new file mode 100644 index 0000000000..4575fb791b --- /dev/null +++ b/iso/README.md @@ -0,0 +1,16 @@ +# Scripts for building a VM iso based on boot2docker + +## Build instructions +./build.sh + +## Test instructions +To manually try out the built iso, you can run the following commands to create a VM: + +```shell +VBoxManage createvm --name testminikube --ostype "Linux_64" --register +VBoxManage storagectl foo --name "IDE Controller" --add ide +VBoxManage storageattach foo --storagectl "IDE Controller" --port 0 --device 0 --type dvddrive --medium ./minikube.iso +VBoxManage modifyvm foo --memory 1024 --vrde on --vrdeaddress 127.0.0.1 --vrdeport 3390 --vrdeauthtype null +``` + +Then use the VirtualBox gui to start and open a session. diff --git a/iso/build.sh b/iso/build.sh new file mode 100755 index 0000000000..4c4a7d6c42 --- /dev/null +++ b/iso/build.sh @@ -0,0 +1,25 @@ +#!/bin/bash +set -e + +ISO=minikube.iso +tmpdir=$(mktemp -d) +echo "Building in $tmpdir." +cp -r . $tmpdir/ + +pushd $tmpdir +# Get nsenter. +docker run --rm jpetazzo/nsenter cat /nsenter > $tmpdir/nsenter && chmod +x $tmpdir/nsenter + +# Do the build. +docker build -t iso . + +# Output the iso. +docker run iso > $ISO + +popd +mv $tmpdir/$ISO . + +# Clean up. +rm -rf $tmpdir + +echo "Iso available at ./$ISO"