Skip to content

Instantly share code, notes, and snippets.

@dysinger
Last active December 17, 2015 17:19
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save dysinger/5645446 to your computer and use it in GitHub Desktop.
Save dysinger/5645446 to your computer and use it in GitHub Desktop.
UBUNTU_NAME='precise'
UBUNTU_VERSION='12.04'
CHEF_VERSION='10.26.0'
ARCH='amd64'
sudo debootstrap --arch=${ARCH} --variant=minbase ${UBUNTU_NAME} ${UBUNTU_NAME}-${BUILD_NUMBER}
snapshot0=$(sudo tar -C ${UBUNTU_NAME}-${BUILD_NUMBER} -c .|docker import -)
sudo rm -rf ${UBUNTU_NAME}-${BUILD_NUMBER}
cat > Dockerfile <<EOF
FROM ${snapshot0}
MAINTAINER Knewton "se@knewton.com"
RUN apt-get update
RUN apt-get install -qq wget
RUN wget http://www.opscode.com/chef/install.sh|bash -s -- -v ${CHEF_VERSION}
RUN mkdir -p /etc/chef /var/chef/cookbooks /var/chef/data_bags
RUN apt-get clean
EOF
docker build < Dockerfile > build.log
cat build.log
snapshot1=$(tail -n 1 build.log)
case "${#snapshot1}" in
"12")
docker tag $snapshot1 knewton/ubuntu-${UBUNTU_VERSION}
docker tag $snapshot1 knewton/ubuntu-${UBUNTU_VERSION} ${BUILD_NUMBER}
docker images
;;
*)
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment