From 89cbcbd0e38d3d6d5dde8f14ea7fe06f9ff5d35f Mon Sep 17 00:00:00 2001 From: Jay Faulkner Date: Mon, 28 Apr 2014 16:13:03 -0700 Subject: [PATCH] Make docker image smaller by using Precise Changing to precise means we don't have both python 3 and 2 installed in the image, only python 2. Also do some cleanup at the end of the build since we are exporting the final filesystem, and don't care about the size of the intermediate layers. Change-Id: Iac61d4a882aee19214de5dd74bbbaacc8b0f3414 --- Dockerfile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index f517477e4..a5367fef5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM jayofdoom/docker-ubuntu-14.04 +FROM stackbrew/ubuntu:precise # The add is before the RUN to ensure we get the latest version of packages # Docker will cache RUN commands, but because the SHA1 of the dir will be @@ -7,9 +7,11 @@ ADD . /tmp/ironic-python-agent # Install requirements: Python for ironic-python-agent, others for putting an # image on disk -RUN apt-get update && apt-get -y install \ - python python-pip python-dev \ - qemu-utils parted util-linux genisoimage git +RUN apt-get update && \ + apt-get -y upgrade && \ + apt-get install -y --no-install-recommends python2.7 python2.7-dev \ + python-pip qemu-utils parted util-linux genisoimage git gcc && \ + apt-get clean # Install requirements separately, because pip understands a git+https url # while setuptools doesn't @@ -17,5 +19,8 @@ RUN pip install -r /tmp/ironic-python-agent/requirements.txt # This will succeed because all the dependencies were installed previously RUN pip install /tmp/ironic-python-agent +RUN rm -rf /tmp/ironic-python-agent + +RUN apt-get -y purge gcc python2.7-dev git && apt-get clean CMD [ "/usr/local/bin/ironic-python-agent" ]