Add BRANCH Argument in the Dockerfile 51/25251/1
authorjose.lausuch <jose.lausuch@ericsson.com>
Wed, 30 Nov 2016 14:49:47 +0000 (15:49 +0100)
committerjose.lausuch <jose.lausuch@ericsson.com>
Wed, 30 Nov 2016 14:51:21 +0000 (15:51 +0100)
This patch allows:
   - clone the respective repo branch while building the image
   - slightly reduce the size of the image by cloning only the latest

Change-Id: I48994d7d9cf230493fa22f39cf1ed7ef4fd72d9e
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
docker/Dockerfile

index fb25bfc..449ad70 100644 (file)
@@ -23,6 +23,8 @@ FROM ubuntu:14.04
 MAINTAINER Jose Lausuch <jose.lausuch@ericsson.com>
 LABEL version="0.1" description="OPNFV Storperf Docker container"
 
+ARG BRANCH=master
+
 ENV repos_dir /home/opnfv/repos
 
 WORKDIR /home/opnfv
@@ -62,8 +64,8 @@ RUN mkdir -p /root/.ssh
 RUN chmod 700 /root/.ssh
 
 RUN git config --global http.sslVerify false
-RUN git clone https://gerrit.opnfv.org/gerrit/storperf ${repos_dir}/storperf
-RUN git clone https://gerrit.opnfv.org/gerrit/releng ${repos_dir}/releng
+RUN git --depth 1 -b $BRANCH clone https://gerrit.opnfv.org/gerrit/storperf ${repos_dir}/storperf
+RUN git --depth 1 clone https://gerrit.opnfv.org/gerrit/releng ${repos_dir}/releng
 
 # Third party git fetches
 RUN git clone https://github.com/swagger-api/swagger-ui.git ${repos_dir}/swagger-ui