Last active
December 17, 2015 17:19
-
-
Save dysinger/5645446 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "[email protected]" | |
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