From 0ec0bfe4006fade9de8dc1f011580f67eddaa49a Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Wed, 3 Jun 2015 11:10:05 -0500 Subject: [PATCH] Update Dockerfile to use new install_rally.sh This delegates more of the magic to the install script, and also has some improvements to the Dockerfile and the related documentation. Closes-Bug: #1461894 Change-Id: I86c0e439b8d0d8f40197fb4a8e26b2655036949c --- .dockerignore | 6 +++++ Dockerfile | 69 ++++++++++++++++++++++++++++++++++----------------- 2 files changed, 52 insertions(+), 23 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..9ed3eecb --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +rally-jobs +tests +Dockerfile +contrib +test-requirements.txt +tox.ini diff --git a/Dockerfile b/Dockerfile index 0e61f6ec..e5ad8c07 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,50 @@ FROM ubuntu:14.04 MAINTAINER Sergey Skripnick + +# install prereqs +RUN apt-get update && apt-get install --yes wget python + +# ubuntu's pip is too old to work with the version of requests we +# require, so get pip with get-pip.py +RUN wget https://bootstrap.pypa.io/get-pip.py && \ + python get-pip.py && \ + rm -f get-pip.py + +# create rally user +RUN useradd -u 65500 -m rally && \ + ln -s /usr/share/doc/rally /home/rally/rally-docs + +# install rally. the COPY command below frequently invalidates +# subsequent cache COPY . /tmp/rally -RUN apt-get update && \ - apt-get -y install git python2.7 bash-completion python-dev libffi-dev \ - libxml2-dev libxslt1-dev libssl-dev libpq-dev wget \ - build-essential &&\ - wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py -O /tmp/pip.py &&\ - python /tmp/pip.py && rm /tmp/pip.py &&\ - cd /tmp/rally &&\ - ./install_rally.sh &&\ - pip install -r optional-requirements.txt &&\ - sed 's|#*connection *=.*|connection = sqlite:////home/rally/.rally.sqlite|' -i /etc/rally/rally.conf &&\ - apt-get -y remove libssl-dev libffi-dev python-dev libxml2-dev \ - libxslt1-dev build-essential gcc-4.8 python3 && \ - apt-get -y autoremove &&\ - apt-get clean &&\ - mv doc /usr/share/doc/rally &&\ - rm -fr /tmp/* &&\ - rm -rf /var/lib/apt/lists/* &&\ - update-alternatives --install /usr/bin/python python /usr/bin/python2.7 10 &&\ - useradd -u 65500 -m rally &&\ - ln -s /usr/share/doc/rally /home/rally/rally-docs -USER rally -CMD bash --login -ENV HOME /home/rally +WORKDIR /tmp/rally +RUN ./install_rally.sh --system --verbose --yes \ + --db-name /home/rally/.rally.sqlite && \ + pip install -r optional-requirements.txt && \ + chmod -R u=rwX,go=rX /etc/rally && \ + mv doc /usr/share/doc/rally && \ + mv samples ~/ && \ + rm -rf /tmp/* && \ + apt-get -y remove \ + build-essential \ + gcc-4.8 \ + libffi-dev \ + libssl-dev \ + libxml2-dev \ + libxslt1-dev \ + python-dev \ + python3 \ + && \ + apt-get -y autoremove && \ + apt-get clean + +VOLUME ["/home/rally"] + WORKDIR /home/rally +USER rally +ENV HOME /home/rally +CMD ["bash", "--login"] + +# TODO(stpierre): Find a way to use `rally` as the +# entrypoint. Currently this is complicated by the need to run +# rally-manage to create the database.