From 2811781b8933d2072e8a6707ef1c8909b3d36625 Mon Sep 17 00:00:00 2001 From: Paul Bourke Date: Tue, 4 Apr 2017 17:10:41 +0100 Subject: [PATCH] Use 'git clone' instead of tarball for scripts Refactor the Dockerfiles to clone the common scripts and checkout a predefined tag, instead of requiring a tarball. Change-Id: I99718c34a86b050c3e83110dc07584e7572fe906 --- centos/Dockerfile | 13 +++++++------ debian/Dockerfile | 13 +++++++------ ubuntu/Dockerfile | 13 +++++++------ 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/centos/Dockerfile b/centos/Dockerfile index 25984e5..d2b0dcd 100644 --- a/centos/Dockerfile +++ b/centos/Dockerfile @@ -7,14 +7,15 @@ ARG WHEELS ARG GIT_REPO=https://git.openstack.org/openstack/${PROJECT} ARG GIT_REF ARG GIT_REF_REPO=https://git.openstack.org/openstack/${PROJECT} -ARG SCRIPTS=https://github.com/yaodu/common/archive/0.1.2.tar.gz +ARG SCRIPTS_REF=0.1.2 +ARG SCRIPTS_REPO=https://github.com/yaodu/common/ ARG OVERRIDE=empty ADD $OVERRIDE / RUN set -x \ - && yum install --setopt=tsflags=nodocs -y python curl \ - && curl -sSL $SCRIPTS | tar xz -C /tmp/ --strip-components=2 \ - && /tmp/download.sh $DOCKER_REPO $DOCKER_TAG $WHEELS \ - && /tmp/install.sh $PROJECT $GIT_REPO $GIT_REF_REPO $GIT_REF \ - && /tmp/cleanup.sh + && yum install --setopt=tsflags=nodocs -y python curl git \ + && git clone --branch $SCRIPTS_REF --depth 1 $SCRIPTS_REPO /tmp/common \ + && /tmp/common/scripts/download.sh $DOCKER_REPO $DOCKER_TAG $WHEELS \ + && /tmp/common/scripts/install.sh $PROJECT $GIT_REPO $GIT_REF_REPO $GIT_REF \ + && /tmp/common/scripts/cleanup.sh diff --git a/debian/Dockerfile b/debian/Dockerfile index 26081e4..5d4e540 100644 --- a/debian/Dockerfile +++ b/debian/Dockerfile @@ -7,15 +7,16 @@ ARG WHEELS ARG GIT_REPO=https://git.openstack.org/openstack/${PROJECT} ARG GIT_REF ARG GIT_REF_REPO=https://git.openstack.org/openstack/${PROJECT} -ARG SCRIPTS=https://github.com/yaodu/common/archive/0.1.2.tar.gz +ARG SCRIPTS_REF=0.1.2 +ARG SCRIPTS_REPO=https://github.com/yaodu/common/ ARG OVERRIDE=empty ADD $OVERRIDE / RUN set -x \ && apt-get update \ - && apt-get install -y --no-install-recommends python ca-certificates curl \ - && curl -sSL $SCRIPTS | tar xz -C /tmp/ --strip-components=2 \ - && /tmp/download.sh $DOCKER_REPO $DOCKER_TAG $WHEELS \ - && /tmp/install.sh $PROJECT $GIT_REPO $GIT_REF_REPO $GIT_REF \ - && /tmp/cleanup.sh + && apt-get install -y --no-install-recommends python ca-certificates curl git \ + && git clone --branch $SCRIPTS_REF --depth 1 $SCRIPTS_REPO /tmp/common \ + && /tmp/common/scripts/download.sh $DOCKER_REPO $DOCKER_TAG $WHEELS \ + && /tmp/common/scripts/install.sh $PROJECT $GIT_REPO $GIT_REF_REPO $GIT_REF \ + && /tmp/common/scripts/cleanup.sh diff --git a/ubuntu/Dockerfile b/ubuntu/Dockerfile index 4b5e3eb..de5cb2b 100644 --- a/ubuntu/Dockerfile +++ b/ubuntu/Dockerfile @@ -7,15 +7,16 @@ ARG WHEELS ARG GIT_REPO=https://git.openstack.org/openstack/${PROJECT} ARG GIT_REF ARG GIT_REF_REPO=https://git.openstack.org/openstack/${PROJECT} -ARG SCRIPTS=https://github.com/yaodu/common/archive/0.1.2.tar.gz +ARG SCRIPTS_REF=0.1.2 +ARG SCRIPTS_REPO=https://github.com/yaodu/common/ ARG OVERRIDE=empty ADD $OVERRIDE / RUN set -x \ && apt-get update \ - && apt-get install -y --no-install-recommends python ca-certificates curl \ - && curl -sSL $SCRIPTS | tar xz -C /tmp/ --strip-components=2 \ - && /tmp/download.sh $DOCKER_REPO $DOCKER_TAG $WHEELS \ - && /tmp/install.sh $PROJECT $GIT_REPO $GIT_REF_REPO $GIT_REF \ - && /tmp/cleanup.sh + && apt-get install -y --no-install-recommends python ca-certificates curl git \ + && git clone --branch $SCRIPTS_REF --depth 1 $SCRIPTS_REPO /tmp/common \ + && /tmp/common/scripts/download.sh $DOCKER_REPO $DOCKER_TAG $WHEELS \ + && /tmp/common/scripts/install.sh $PROJECT $GIT_REPO $GIT_REF_REPO $GIT_REF \ + && /tmp/common/scripts/cleanup.sh