Make our docker-image more user-friendly

- move from ubuntu:14.04 base image to ubuntu:16.04 .
  Ubuntu 16.04 is current/latest LTS release. Let's use it.

- pre-install vim
  It is a "feaute request". Users like to experiment and modify samples
  inside container.

- pre-install bash-completion
  Rally provides bash-completion script, but uit doesn't work without
  installed `bash-completion` package.

- remove '-e' from execution of `echo`.
  This flag is not required, even more it is redundant.

- add sudo rights to rally user
  Rally is a pluggable framework. External plugins can require installation
  of additional python or system packages.

Change-Id: I9540343adbb48fded5531bd3c819396cdb7328df
This commit is contained in:
Andrey Kurilin 2016-07-26 15:20:13 +03:00
parent f8a86b4489
commit 2c34f34ac4

View File

@ -1,8 +1,8 @@
FROM ubuntu:14.04
FROM ubuntu:16.04
MAINTAINER Sergey Skripnick <sskripnick@mirantis.com>
# install prereqs
RUN apt-get update && apt-get install --yes wget python
RUN apt-get update && apt-get install --yes wget python vim bash-completion
# ubuntu's pip is too old to work with the version of requests we
# require, so get pip with get-pip.py
@ -11,7 +11,10 @@ RUN wget https://bootstrap.pypa.io/get-pip.py && \
rm -f get-pip.py
# create rally user
RUN useradd -u 65500 -m rally && \
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
@ -25,7 +28,7 @@ RUN ./install_rally.sh --system --verbose --yes \
# TODO(andreykurilin): build docs to rst before move, since we have several
# extensions.
mv certification/ samples/ doc/ /opt/rally/ && \
chmod -R u=rwX,go=rX /opt/rally /etc/rally && \
chown -R rally /opt/rally /etc/rally && \
rm -rf /tmp/* && \
apt-get -y remove \
build-essential \
@ -37,13 +40,16 @@ RUN ./install_rally.sh --system --verbose --yes \
apt-get clean
RUN echo '[ ! -z "$TERM" -a -r /etc/motd ] && cat /etc/motd' \
>> /etc/bash.bashrc; echo -e 'Welcome to Rally Docker container!\n\
Rally certification tasks, samples and docs are located at /opt/rally/\n\
Rally at readthedocs - http://rally.readthedocs.org\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\
* e-mail - openstack-dev@lists.openstack.org with tag [Rally] in subject\n\
* irc - "#openstack-rally" channel at freenode.net' > /etc/motd
>> /etc/bash.bashrc; echo '\
╔═════════════════════════════════════════════════════════════════════════════╗\n\
║ Welcome to Rally Docker container! ║\n\
║ Rally certification tasks, samples and docs are located at /opt/rally/ ║\n\
║ Rally at readthedocs - http://rally.readthedocs.org ║\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\
║ * e-mail - openstack-dev@lists.openstack.org with tag [Rally] in subject ║\n\
║ * irc - "#openstack-rally" channel at freenode.net ║\n\
╚═════════════════════════════════════════════════════════════════════════════╝\n' > /etc/motd
VOLUME ["/home/rally"]