Optimize Dockerfile 05/39005/4
authorzhihui wu <wu.zhihui1@zte.com.cn>
Wed, 9 Aug 2017 09:25:07 +0000 (17:25 +0800)
committerzhihui wu <wu.zhihui1@zte.com.cn>
Thu, 10 Aug 2017 08:39:07 +0000 (16:39 +0800)
- Add new packages what storperf scripts need : curl and wget
- Minimize the number of layers
- ansible is already in requirements.txt, delete the apt-get commands

Change-Id: Ie04d6618737146674396a7c005a247829f06c1d9
Signed-off-by: zhihui wu <wu.zhihui1@zte.com.cn>
docker/Dockerfile

index bab503f..8109fb6 100644 (file)
@@ -8,11 +8,17 @@ LABEL version="0.1" description="OPNFV QTIP Docker container"
 
 ARG BRANCH=master
 
-ENV REPOS_DIR /home/opnfv/repos
-ENV PYTHONPATH /home/opnfv/repos/qtip
-ENV USER root
+ENV REPOS_DIR=/home/opnfv/repos \
+    PYTHONPATH=/home/opnfv/repos/qtip \
+    USER=root
+
 WORKDIR /home/opnfv
 
+RUN mkdir -p ${REPOS_DIR} \
+    && mkdir -p /root/qtip/logs \
+    && mkdir -p /root/.ssh \
+    && chmod 700 /root/.ssh
+
 # Packaged Dependencies
 RUN apt-get update && apt-get install -y \
     software-properties-common \
@@ -28,26 +34,18 @@ RUN apt-get update && apt-get install -y \
     python-setuptools \
     rsync \
     iputils-ping \
+    wget \
+    curl \
     --no-install-recommends \
-&& rm -rf /var/lib/apt/lists/*
+    && rm -rf /var/lib/apt/lists/*
 
 RUN pip install -U pip && pip install -U setuptools
 
-RUN apt-add-repository ppa:ansible/ansible -y
-RUN apt-key update -y
-RUN apt-get update && apt-get install ansible -y
-
-RUN mkdir -p ${REPOS_DIR}
-RUN mkdir -p /root/.ssh
-RUN mkdir -p /root/qtip/logs
-
-RUN chmod 700 /root/.ssh
-
 #Cloning Repos
-RUN git config --global http.sslVerify false
-RUN git clone -b $BRANCH https://gerrit.opnfv.org/gerrit/qtip $REPOS_DIR/qtip
-
-RUN cd $REPOS_DIR/qtip && pip install -U -e .
+RUN git config --global http.sslVerify false \
+    && git clone -b $BRANCH https://gerrit.opnfv.org/gerrit/qtip $REPOS_DIR/qtip \
+    && cd $REPOS_DIR/qtip \
+    && pip install -U -e .
 
 RUN echo 'eval $(ssh-agent)' >> /root/.bashrc
 
@@ -55,8 +53,7 @@ RUN echo 'eval $(ssh-agent)' >> /root/.bashrc
 EXPOSE 5000
 
 #Config supervisor
-RUN mkdir -p /var/log/supervisor
-RUN locale-gen en_US en_US.UTF-8
+RUN mkdir -p /var/log/supervisor && locale-gen en_US en_US.UTF-8
 COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
 
 CMD ["/usr/bin/supervisord"]
\ No newline at end of file