Dockerfile - trivial fixes

* Move motd to file
 * Change borer symbol - old one can 'stuck' some terminals.
 * clean pip cache after build
 * remove dev-src from sources list

Change-Id: I69df7ba916521920757460e546c066a80017b908
This commit is contained in:
alexz 2018-02-07 15:57:58 +01:00 committed by Andrey Kurilin
parent ea2d579d75
commit c783931416
2 changed files with 26 additions and 22 deletions

View File

@ -1,5 +1,7 @@
FROM ubuntu:16.04 FROM ubuntu:16.04
RUN sed -i s/^deb-src.*// /etc/apt/sources.list
RUN apt-get update && apt-get install --yes sudo python python-pip vim git-core && \ RUN apt-get update && apt-get install --yes sudo python python-pip vim git-core && \
pip install --upgrade pip && \ pip install --upgrade pip && \
useradd -u 65500 -m rally && \ useradd -u 65500 -m rally && \
@ -7,37 +9,20 @@ RUN apt-get update && apt-get install --yes sudo python python-pip vim git-core
echo "rally ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/00-rally-user echo "rally ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/00-rally-user
COPY . /home/rally/source COPY . /home/rally/source
COPY etc/motd /etc/motd
WORKDIR /home/rally/source WORKDIR /home/rally/source
RUN pip install . --constraint upper-constraints.txt && \ RUN pip install . --constraint upper-constraints.txt && \
mkdir /etc/rally && \ mkdir /etc/rally && \
echo "[database]" > /etc/rally/rally.conf && \ echo "[database]" > /etc/rally/rally.conf && \
echo "connection=sqlite:////home/rally/data/rally.db" >> /etc/rally/rally.conf echo "connection=sqlite:////home/rally/data/rally.db" >> /etc/rally/rally.conf
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
>> /etc/bash.bashrc; echo '\ # Cleanup pip
╔═════════════════════════════════════════════════════════════════════════════╗\n\ RUN rm -rf /root/.cache/
║ Welcome to Rally Docker container! ║\n\
║ ║\n\
║ WARNING: DO NOT OVERRIDE /home/rally DIRECTORY ║\n\
║ ║\n\
║ /home/rally/data - a default place with rally database. Use it for\n\
║ mounting own directories and synchronizing rally database. ║\n\
║ /home/rally/source - a directory with documentation, pre created tasks, ║\n\
║ sampes and source code ║\n\
║ /etc/rally/rally.conf - a default configuration file of rally. To override ║\n\
║ it, mount custom configuration file to /home/rally/.rally/rally.conf ║\n\
║ ║\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\
║ * gitter - https://gitter.im/xRally/Lobby room ║\n\
║ * irc - "#openstack-rally" channel at freenode.net ║\n\
╚═════════════════════════════════════════════════════════════════════════════╝\n' > /etc/motd
USER rally USER rally
ENV HOME /home/rally ENV HOME /home/rally
RUN mkdir /home/rally/data && rally db recreate RUN mkdir -p /home/rally/data && rally db recreate
# Docker volumes have specific behavior that allows this construction to work. # 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 # Data generated during the image creation is copied to volume only when it's

19
etc/motd Normal file
View File

@ -0,0 +1,19 @@
###############################################################################
# Welcome to Rally Docker container! #
# #
# WARNING: DO NOT OVERRIDE /home/rally DIRECTORY #
# #
# /home/rally/data - a default place with rally database. Use it for #
# mounting own directories and synchronizing rally database. #
# /home/rally/source - a directory with documentation, pre created tasks, #
# sampes and source code #
# /etc/rally/rally.conf - a default configuration file of rally. To override #
# it, mount custom configuration file to /home/rally/.rally/rally.conf #
# #
# Rally at readthedocs - http://rally.readthedocs.org #
# How to contribute - http://rally.readthedocs.org/en/latest/contribute.html #
# If you have any questions, you can reach the Rally team by: #
# * e-mail - openstack-dev@lists.openstack.org with tag [Rally] in subject #
# * gitter - https://gitter.im/xRally/Lobby room #
# * irc - "#openstack-rally" channel at freenode.net #
###############################################################################