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
This commit is contained in:
Chris St. Pierre 2015-06-03 11:10:05 -05:00
parent de623eabf3
commit 0ec0bfe400
2 changed files with 52 additions and 23 deletions

6
.dockerignore Normal file
View File

@ -0,0 +1,6 @@
rally-jobs
tests
Dockerfile
contrib
test-requirements.txt
tox.ini

View File

@ -1,27 +1,50 @@
FROM ubuntu:14.04 FROM ubuntu:14.04
MAINTAINER Sergey Skripnick <sskripnick@mirantis.com> MAINTAINER Sergey Skripnick <sskripnick@mirantis.com>
COPY . /tmp/rally
RUN apt-get update && \ # install prereqs
apt-get -y install git python2.7 bash-completion python-dev libffi-dev \ RUN apt-get update && apt-get install --yes wget python
libxml2-dev libxslt1-dev libssl-dev libpq-dev wget \
build-essential &&\ # ubuntu's pip is too old to work with the version of requests we
wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py -O /tmp/pip.py &&\ # require, so get pip with get-pip.py
python /tmp/pip.py && rm /tmp/pip.py &&\ RUN wget https://bootstrap.pypa.io/get-pip.py && \
cd /tmp/rally &&\ python get-pip.py && \
./install_rally.sh &&\ rm -f get-pip.py
pip install -r optional-requirements.txt &&\
sed 's|#*connection *=.*|connection = sqlite:////home/rally/.rally.sqlite|' -i /etc/rally/rally.conf &&\ # create rally user
apt-get -y remove libssl-dev libffi-dev python-dev libxml2-dev \ RUN useradd -u 65500 -m rally && \
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 ln -s /usr/share/doc/rally /home/rally/rally-docs
USER rally
CMD bash --login # install rally. the COPY command below frequently invalidates
ENV HOME /home/rally # subsequent cache
COPY . /tmp/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 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.