You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ma...@apache.org on 2020/08/22 00:44:14 UTC

[ranger] branch ranger-2.1 updated: RANGER-2960: Dockerfile to build Apache Ranger

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

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


The following commit(s) were added to refs/heads/ranger-2.1 by this push:
     new fc95acc  RANGER-2960: Dockerfile to build Apache Ranger
fc95acc is described below

commit fc95accb67c1a7e0acf49b5b847fc0a69346c7c4
Author: Madhan Neethiraj <ma...@apache.org>
AuthorDate: Mon Aug 17 23:59:54 2020 -0700

    RANGER-2960: Dockerfile to build Apache Ranger
    
    (cherry picked from commit a19b445f6f8d66b99e41cc458312c6afbc1debe1)
---
 dev-support/ranger-docker/.dockerignore            |  1 +
 dev-support/ranger-docker/.gitignore               | 10 +++++
 .../ranger-docker/Dockerfile.ranger-base-ubuntu    | 46 ++++++++++++++++++++++
 .../ranger-docker/Dockerfile.ranger-build-ubuntu   | 38 ++++++++++++++++++
 dev-support/ranger-docker/README.md                | 44 +++++++++++++++++++++
 dev-support/ranger-docker/scripts/ranger-build.sh  | 44 +++++++++++++++++++++
 6 files changed, 183 insertions(+)

diff --git a/dev-support/ranger-docker/.dockerignore b/dev-support/ranger-docker/.dockerignore
new file mode 100644
index 0000000..72e8ffc
--- /dev/null
+++ b/dev-support/ranger-docker/.dockerignore
@@ -0,0 +1 @@
+*
diff --git a/dev-support/ranger-docker/.gitignore b/dev-support/ranger-docker/.gitignore
new file mode 100644
index 0000000..a375c4c
--- /dev/null
+++ b/dev-support/ranger-docker/.gitignore
@@ -0,0 +1,10 @@
+*.class
+*.iml
+.settings/
+.metadata
+.classpath
+.project
+/dist/
+/target/
+.DS_Store
+.idea
diff --git a/dev-support/ranger-docker/Dockerfile.ranger-base-ubuntu b/dev-support/ranger-docker/Dockerfile.ranger-base-ubuntu
new file mode 100644
index 0000000..19cf4f0
--- /dev/null
+++ b/dev-support/ranger-docker/Dockerfile.ranger-base-ubuntu
@@ -0,0 +1,46 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+FROM ubuntu:20.04
+
+# Install curl, wget, tzdata, Python, Java, python-requests
+RUN apt-get update && \
+    DEBIAN_FRONTEND="noninteractive" apt-get -y install curl wget tzdata python python3 python3-pip openjdk-8-jdk && \
+    curl https://bootstrap.pypa.io/get-pip.py --output /tmp/get-pip.py && \
+    python2 /tmp/get-pip.py && \
+    pip3 install requests && \
+    pip install requests
+
+# Set environment variables
+ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
+ENV PATH /usr/java/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+
+# setup ranger group, and users
+RUN groupadd ranger && \
+    useradd -g ranger -ms /bin/bash ranger && \
+    useradd -g ranger -ms /bin/bash rangeradmin && \
+    useradd -g ranger -ms /bin/bash rangerugsync && \
+    useradd -g ranger -ms /bin/bash rangertagsync && \
+    useradd -g ranger -ms /bin/bash rangerkms && \
+    mkdir -p /home/ranger/dist && \
+    mkdir -p /home/ranger/scripts && \
+	mkdir -p /home/ranger/bin/ && \
+	chown -R ranger:ranger /home/ranger
+
+VOLUME /home/ranger/dist
+VOLUME /home/ranger/scripts
+
+ENTRYPOINT [ "/bin/bash" ]
diff --git a/dev-support/ranger-docker/Dockerfile.ranger-build-ubuntu b/dev-support/ranger-docker/Dockerfile.ranger-build-ubuntu
new file mode 100644
index 0000000..54b750f
--- /dev/null
+++ b/dev-support/ranger-docker/Dockerfile.ranger-build-ubuntu
@@ -0,0 +1,38 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+FROM ranger-base-ubuntu:latest
+
+# Install Git, Maven, gcc
+RUN apt-get update && \
+    apt-get -y install git maven build-essential
+
+# Set environment variables
+ENV MAVEN_HOME /usr/share/maven
+ENV PATH /usr/java/bin:/usr/local/apache-maven/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+
+USER ranger
+
+RUN mkdir -p /home/ranger/git && \
+    mkdir -p /home/ranger/.m2
+
+VOLUME /home/ranger/.m2
+
+WORKDIR /home/ranger/git
+
+RUN git clone https://github.com/apache/ranger.git
+
+ENTRYPOINT [ "/home/ranger/scripts/ranger-build.sh" ]
diff --git a/dev-support/ranger-docker/README.md b/dev-support/ranger-docker/README.md
new file mode 100644
index 0000000..90c63bb
--- /dev/null
+++ b/dev-support/ranger-docker/README.md
@@ -0,0 +1,44 @@
+<!---
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+## Overview
+
+Dockerfile.build-ubuntu in this folder builds a Docker image to build Apache Ranger.
+
+## Usage
+
+1. Ensure that you have a recent version of Docker installed from
+   [docker.io](http://www.docker.io).
+
+2. Set this folder as your working directory.
+
+3. Execute following command to build a Docker image called **ranger-base-ubuntu**.
+       docker build -f Dockerfile.ranger-base-ubuntu -t ranger-base-ubuntu .
+   This might take about 10 minutes to complete.
+
+4. Execute following command to build a Docker image called **ranger-build-ubuntu**.
+       docker build -f Dockerfile.ranger-build-ubuntu -t ranger-build-ubuntu .
+   This might take about 10 minutes to complete.
+
+5. Build Apache Ranger with the following commands:
+       mkdir -p ./dist
+       docker run -it --rm -v $(pwd)/scripts:/home/ranger/scripts -v ${HOME}/.m2:/home/ranger/.m2 -v $(pwd)/dist:/home/ranger/dist ranger-build-ubuntu -b master
+   Time taken to complete the build might vary (upto an hour), depending on status of ${HOME}/.m2 directory cache.
+
+6. After completion of build, dist files (like ranger-admin-<version>.tar.gz) will be available under ./dist directory.
diff --git a/dev-support/ranger-docker/scripts/ranger-build.sh b/dev-support/ranger-docker/scripts/ranger-build.sh
new file mode 100755
index 0000000..a89ea2a
--- /dev/null
+++ b/dev-support/ranger-docker/scripts/ranger-build.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+BRANCH=master
+PROFILES=
+SKIP_TESTS="-DskipTests=true"
+
+while getopts ":b:p:s:" arg
+do
+  case $arg in
+    b) BRANCH=$OPTARG;;
+    p) PROFILES="-P \"$OPTARG\"";;
+    s) SKIP_TESTS="-DskipTests=$OPTARG";;
+  esac
+done
+
+
+export MAVEN_OPTS="-Xms2g -Xmx2g"
+export M2=/home/ranger/.m2
+
+cd /home/ranger/git/ranger
+
+git checkout ${BRANCH}
+git pull
+
+mvn ${PROFILES} ${SKIP_TESTS} -DskipDocs clean package
+
+mv -f target/version /home/ranger/dist/
+mv -f target/ranger-* /home/ranger/dist/