Simplify & Improve Dockerfile
- Remove usage of install_rally - Remove installation of not used packages - Remove installation of python-pip from sources - Put DB and Config on volume in /home/rally/.rally/ Change-Id: Ib48dda24056e2930c22dda75762a8f7c4ede29c0
This commit is contained in:
parent
1b09eb3e3f
commit
4a36220734
72
Dockerfile
72
Dockerfile
@ -1,52 +1,21 @@
|
|||||||
FROM ubuntu:16.04
|
FROM ubuntu:16.04
|
||||||
MAINTAINER Sergey Skripnick <sskripnick@mirantis.com>
|
|
||||||
|
|
||||||
# install prereqs
|
RUN apt-get update && apt-get install --yes sudo python python-pip vim git-core && \
|
||||||
RUN apt-get update && apt-get install --yes wget python vim bash-completion gcc lsb-release
|
pip install --upgrade pip && \
|
||||||
|
useradd -u 65500 -m rally && \
|
||||||
|
usermod -aG sudo rally && \
|
||||||
|
echo "rally ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/00-rally-user
|
||||||
|
|
||||||
# ubuntu's pip is too old to work with the version of requests we
|
COPY . /home/rally/source
|
||||||
# require, so get pip with get-pip.py
|
WORKDIR /home/rally/source
|
||||||
RUN wget https://bootstrap.pypa.io/get-pip.py && \
|
|
||||||
python get-pip.py && \
|
|
||||||
rm -f get-pip.py
|
|
||||||
|
|
||||||
# install bindep
|
|
||||||
RUN pip install bindep
|
|
||||||
|
|
||||||
# create rally user
|
|
||||||
RUN apt-get install sudo && \
|
|
||||||
useradd -u 65500 -m rally && \
|
|
||||||
usermod -aG sudo rally && \
|
|
||||||
echo "rally ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/00-rally-user && \
|
|
||||||
ln -s /opt/rally/doc /home/rally/rally-docs
|
|
||||||
|
|
||||||
# install rally. the COPY command below frequently invalidates
|
|
||||||
# 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 && \
|
|
||||||
mkdir /opt/rally/ && \
|
|
||||||
# TODO(andreykurilin): build docs to rst before move, since we have several
|
|
||||||
# extensions.
|
|
||||||
mv certification/ samples/ doc/ /opt/rally/ && \
|
|
||||||
chown -R rally /opt/rally /etc/rally && \
|
|
||||||
rm -rf /tmp/* && \
|
|
||||||
apt-get -y remove \
|
|
||||||
build-essential \
|
|
||||||
libxml2-dev \
|
|
||||||
libxslt1-dev \
|
|
||||||
python3 \
|
|
||||||
&& \
|
|
||||||
apt-get -y autoremove && \
|
|
||||||
apt-get clean
|
|
||||||
|
|
||||||
|
RUN pip install .
|
||||||
RUN echo '[ ! -z "$TERM" -a -r /etc/motd ] && cat /etc/motd' \
|
RUN echo '[ ! -z "$TERM" -a -r /etc/motd ] && cat /etc/motd' \
|
||||||
>> /etc/bash.bashrc; echo '\
|
>> /etc/bash.bashrc; echo '\
|
||||||
╔═════════════════════════════════════════════════════════════════════════════╗\n\
|
╔═════════════════════════════════════════════════════════════════════════════╗\n\
|
||||||
║ Welcome to Rally Docker container! ║\n\
|
║ Welcome to Rally Docker container! ║\n\
|
||||||
║ Rally certification tasks, samples and docs are located at /opt/rally/ ║\n\
|
║ Rally certification tasks, samples and docs are located at ~/source/ ║\n\
|
||||||
|
║ Rally configuration and DB are in ~/.rally/ ║\n\
|
||||||
║ Rally at readthedocs - http://rally.readthedocs.org ║\n\
|
║ Rally at readthedocs - http://rally.readthedocs.org ║\n\
|
||||||
║ How to contribute - http://rally.readthedocs.org/en/latest/contribute.html ║\n\
|
║ How to contribute - http://rally.readthedocs.org/en/latest/contribute.html ║\n\
|
||||||
║ If you have any questions, you can reach the Rally team by: ║\n\
|
║ If you have any questions, you can reach the Rally team by: ║\n\
|
||||||
@ -54,15 +23,16 @@ RUN echo '[ ! -z "$TERM" -a -r /etc/motd ] && cat /etc/motd' \
|
|||||||
║ * irc - "#openstack-rally" channel at freenode.net ║\n\
|
║ * irc - "#openstack-rally" channel at freenode.net ║\n\
|
||||||
╚═════════════════════════════════════════════════════════════════════════════╝\n' > /etc/motd
|
╚═════════════════════════════════════════════════════════════════════════════╝\n' > /etc/motd
|
||||||
|
|
||||||
VOLUME ["/home/rally"]
|
|
||||||
|
|
||||||
WORKDIR /home/rally/
|
|
||||||
USER rally
|
USER rally
|
||||||
ENV HOME /home/rally/
|
ENV HOME /home/rally
|
||||||
CMD ["bash", "--login"]
|
WORKDIR /home/rally
|
||||||
|
RUN mkdir .rally && \
|
||||||
|
cp ./source/etc/rally/rally.conf.sample .rally/rally.conf && \
|
||||||
|
sed -i "s|#connection *=.*|connection = \"sqlite:////home/rally/.rally/rally.db\"|" .rally/rally.conf && \
|
||||||
|
rally db recreate
|
||||||
|
|
||||||
RUN rally-manage db recreate
|
# Docker volumes have specific behavior that allows this construction to work.
|
||||||
|
# Data generated during the image creation is copied to volume only when it's
|
||||||
# TODO(stpierre): Find a way to use `rally` as the
|
# attached for the first time (volume initialization)
|
||||||
# entrypoint. Currently this is complicated by the need to run
|
VOLUME ["/home/rally"]
|
||||||
# rally-manage to create the database.
|
ENTRYPOINT ["rally"]
|
||||||
|
Loading…
Reference in New Issue
Block a user