This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new e41a4b4  ATLAS-3934: Dockerfile: updated default to build from local 
repo (instead of from github) - #2
e41a4b4 is described below

commit e41a4b45774ddd93d232a748d9e2e75bf188d68a
Author: Madhan Neethiraj <[email protected]>
AuthorDate: Wed Sep 23 12:07:05 2020 -0700

    ATLAS-3934: Dockerfile: updated default to build from local repo (instead 
of from github) - #2
    
    (cherry picked from commit d0e246a7096d870b1bc6ee3dd46428bd3bf4b1e6)
---
 dev-support/atlas-docker/Dockerfile.atlas-build    |  4 ----
 dev-support/atlas-docker/README.md                 |  4 ++--
 .../atlas-docker/docker-compose.atlas-build.yml    |  3 ++-
 dev-support/atlas-docker/scripts/atlas-build.sh    | 23 ++++++++++++++++++----
 4 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/dev-support/atlas-docker/Dockerfile.atlas-build 
b/dev-support/atlas-docker/Dockerfile.atlas-build
index 58d127a..bc27e9f 100644
--- a/dev-support/atlas-docker/Dockerfile.atlas-build
+++ b/dev-support/atlas-docker/Dockerfile.atlas-build
@@ -42,8 +42,4 @@ VOLUME /home/atlas/src
 
 USER atlas
 
-WORKDIR /home/atlas/git
-
-RUN git clone https://github.com/apache/atlas.git
-
 ENTRYPOINT [ "/home/atlas/scripts/atlas-build.sh" ]
diff --git a/dev-support/atlas-docker/README.md 
b/dev-support/atlas-docker/README.md
index 21f9b75..9e56fa1 100644
--- a/dev-support/atlas-docker/README.md
+++ b/dev-support/atlas-docker/README.md
@@ -56,10 +56,10 @@ Docker files in this folder create docker images and run 
them to build Apache At
    4.3. Build Apache Atlas in a container with one of the following commands:
 
         # to build from a specific branch
-        docker run -it --rm -v ${HOME}/.m2:/home/atlas/.m2 -v 
$(pwd)/scripts:/home/atlas/scripts -v $(pwd)/patches:/home/atlas/patches -v 
$(pwd)/dist:/home/atlas/dist -e BRANCH=master -e PROFILE=dist,berkeley-solr -e 
SKIPTESTS=true atlas-build
+        docker run -it --rm -v ${HOME}/.m2:/home/atlas/.m2:delegated -v 
$(pwd)/scripts:/home/atlas/scripts -v $(pwd)/patches:/home/atlas/patches -v 
$(pwd)/dist:/home/atlas/dist -e BRANCH=master -e PROFILE=dist,berkeley-solr -e 
SKIPTESTS=true atlas-build
 
         # to build from local sources
-        docker run -it --rm -v ${HOME}/.m2:/home/atlas/.m2 -v 
$(pwd)/scripts:/home/atlas/scripts -v $(pwd)/../..:/home/atlas/src -v 
$(pwd)/dist:/home/atlas/dist -e PROFILE=dist,berkeley-solr -e SKIPTESTS=true 
atlas-build
+        docker run -it --rm -v ${HOME}/.m2:/home/atlas/.m2:delegated -v 
$(pwd)/scripts:/home/atlas/scripts -v $(pwd)/../..:/home/atlas/src:delegated -v 
$(pwd)/dist:/home/atlas/dist -e PROFILE=dist,berkeley-solr -e SKIPTESTS=true 
atlas-build
 
    Time taken to complete the build might vary (upto an hour), depending on 
status of ${HOME}/.m2 directory cache.
 
diff --git a/dev-support/atlas-docker/docker-compose.atlas-build.yml 
b/dev-support/atlas-docker/docker-compose.atlas-build.yml
index a1bc2f7..c72b7d1 100644
--- a/dev-support/atlas-docker/docker-compose.atlas-build.yml
+++ b/dev-support/atlas-docker/docker-compose.atlas-build.yml
@@ -12,10 +12,11 @@ services:
     networks:
       - atlas
     volumes:
-      - ~/.m2:/home/atlas/.m2
+      - ~/.m2:/home/atlas/.m2:delegated
       - ./scripts:/home/atlas/scripts
       - ./patches:/home/atlas/patches
       - ./dist:/home/atlas/dist
+      - ./../..:/home/atlas/src:delegated
     depends_on:
       - atlas-base
     environment:
diff --git a/dev-support/atlas-docker/scripts/atlas-build.sh 
b/dev-support/atlas-docker/scripts/atlas-build.sh
index b920034..eafe4bd 100755
--- a/dev-support/atlas-docker/scripts/atlas-build.sh
+++ b/dev-support/atlas-docker/scripts/atlas-build.sh
@@ -21,6 +21,11 @@ then
   BRANCH=master
 fi
 
+if [ "${GIT_URL}" == "" ]
+then
+  GIT_URL=https://github.com/apache/atlas.git
+fi
+
 if [ "${PROFILE}" != "" ]
 then
   ARG_PROFILES="-P${PROFILE}"
@@ -43,12 +48,22 @@ then
 
   cd /home/atlas/src
 else
-  echo "Building from /home/atlas/git/atlas"
+  echo "Building ${BRANCH} branch from ${GIT_URL}"
 
-  cd /home/atlas/git/atlas
+  cd /home/atlas/git
+
+  if [ -d atlas ]
+  then
+    renamedDir=atlas-`date +"%Y%m%d-%H%M%S"`
 
-  git checkout ${BRANCH}
-  git pull
+    echo "Renaming existing directory `pwd`/atlas to ${renamedDir}"
+
+    mv atlas $renamedDir
+  fi
+
+  git clone --single-branch --branch ${BRANCH} ${GIT_URL}
+
+  cd /home/atlas/git/atlas
 
   for patch in `ls -1 /home/atlas/patches | sort`
   do

Reply via email to