ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adorosz...@apache.org
Subject [ambari] branch trunk updated: Dockerfiles for building Ambari (CentOS, Ubuntu) (#391)
Date Fri, 16 Feb 2018 16:27:45 GMT
This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new a59d340  Dockerfiles for building Ambari (CentOS, Ubuntu) (#391)
a59d340 is described below

commit a59d3401bd12ee257f54933e9a1f1b13d36e78d3
Author: Doroszlai, Attila <6454655+adoroszlai@users.noreply.github.com>
AuthorDate: Fri Feb 16 17:27:42 2018 +0100

    Dockerfiles for building Ambari (CentOS, Ubuntu) (#391)
---
 dev-support/docker/centos6/Dockerfile  | 33 ++++++++++++++++++
 dev-support/docker/centos7/Dockerfile  | 37 ++++++++++++++++++++
 dev-support/docker/common/.bashrc      | 17 +++++++++
 dev-support/docker/common/Dockerfile   | 34 ++++++++++++++++++
 dev-support/docker/ubuntu16/Dockerfile | 35 +++++++++++++++++++
 start-build-env.sh                     | 64 ++++++++++++++++++++++++++++++++++
 6 files changed, 220 insertions(+)

diff --git a/dev-support/docker/centos6/Dockerfile b/dev-support/docker/centos6/Dockerfile
new file mode 100644
index 0000000..ee66f45
--- /dev/null
+++ b/dev-support/docker/centos6/Dockerfile
@@ -0,0 +1,33 @@
+# 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.
+
+# Dockerfile for installing the necessary dependencies for building Ambari on CentOS6
+
+FROM centos:6
+
+RUN yum -y install \
+    gcc \
+    gcc-c++ \
+    git \
+    java-1.8.0-openjdk-devel \
+    python-devel \
+    python-setuptools \
+    rpm-build \
+  && yum clean all \
+  && rm -rf /var/cache/yum
+
+RUN curl -LSs -o /usr/local/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64
\
+  && chmod 755 /usr/local/bin/jq
diff --git a/dev-support/docker/centos7/Dockerfile b/dev-support/docker/centos7/Dockerfile
new file mode 100644
index 0000000..0e8199a
--- /dev/null
+++ b/dev-support/docker/centos7/Dockerfile
@@ -0,0 +1,37 @@
+# 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.
+
+# Dockerfile for installing the necessary dependencies for building Ambari on CentOS7
+
+FROM centos:7
+
+RUN yum -q -y install \
+    curl \
+    gcc \
+    gcc-c++ \
+    git \
+    java-1.8.0-openjdk-devel \
+    make \
+    python \
+    python-devel \
+    python-setuptools \
+    rpm-build \
+    which \
+  && yum clean all \
+  && rm -rf /var/cache/yum
+
+RUN curl -LSs -o /usr/local/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64
\
+  && chmod 755 /usr/local/bin/jq
diff --git a/dev-support/docker/common/.bashrc b/dev-support/docker/common/.bashrc
new file mode 100644
index 0000000..f8deaf4
--- /dev/null
+++ b/dev-support/docker/common/.bashrc
@@ -0,0 +1,17 @@
+# 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.
+
+export PS1='\h:\w \$ '
diff --git a/dev-support/docker/common/Dockerfile b/dev-support/docker/common/Dockerfile
new file mode 100644
index 0000000..aa39435
--- /dev/null
+++ b/dev-support/docker/common/Dockerfile
@@ -0,0 +1,34 @@
+# 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.
+
+# Dockerfile for installing the necessary dependencies for building Ambari
+
+ARG BUILD_OS
+FROM ambari-build-base:${BUILD_OS}
+
+ARG MAVEN_VERSION=3.3.9
+ENV MAVEN_HOME /opt/maven
+RUN mkdir -p $MAVEN_HOME \
+  && maven_url=$(curl -L -s -S http://www.apache.org/dyn/closer.cgi/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz?as_json=1
\
+      | jq --raw-output '.preferred,.path_info' \
+      | sed -e '1N' -e 's/\n//') \
+  && : ${maven_url:="http://www.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz"}
\
+  && echo "Downloading Maven from ${maven_url}" \
+  && curl -L -s -S "${maven_url}" \
+    | tar -xzf - --strip-components 1 -C $MAVEN_HOME
+ENV PATH "$PATH:$MAVEN_HOME/bin"
+
+COPY .bashrc /root/
diff --git a/dev-support/docker/ubuntu16/Dockerfile b/dev-support/docker/ubuntu16/Dockerfile
new file mode 100644
index 0000000..9008a5a
--- /dev/null
+++ b/dev-support/docker/ubuntu16/Dockerfile
@@ -0,0 +1,35 @@
+# 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.
+
+# Dockerfile for installing the necessary dependencies for building Ambari on Ubuntu 16.04
+
+FROM ubuntu:16.04
+
+RUN apt-get update -q -y \
+  && apt-get install -y --no-install-recommends \
+    bzip2 \
+    curl \
+    g++ \
+    gcc \
+    git \
+    jq \
+    make \
+    openjdk-8-jdk \
+    python-setuptools \
+    python2.7 \
+    python2.7-dev \
+    xz-utils \
+  && rm -rf /var/lib/apt/lists/*
diff --git a/start-build-env.sh b/start-build-env.sh
new file mode 100755
index 0000000..2041d97
--- /dev/null
+++ b/start-build-env.sh
@@ -0,0 +1,64 @@
+#!/usr/bin/env 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.
+
+# Start a Docker-based build environment
+
+set -e -u
+
+cd "$(dirname "$0")"
+
+# OS to build on
+: ${BUILD_OS:=centos7}
+
+# Directory with Ambari source
+: ${AMBARI_DIR:=$(pwd -P)}
+
+# Maven version
+: ${MAVEN_VERSION:=3.3.9}
+
+docker build -t ambari-build-base:${BUILD_OS} dev-support/docker/${BUILD_OS}
+docker build -t ambari-build:${BUILD_OS} --build-arg BUILD_OS="${BUILD_OS}" --build-arg MAVEN_VERSION="${MAVEN_VERSION}"
dev-support/docker/common
+
+USER_NAME=${SUDO_USER:=$USER}
+USER_ID=$(id -u "${USER_NAME}")
+GROUP_ID=$(id -g "${USER_NAME}")
+USER_TAG="ambari-build-${USER_NAME}-${USER_ID}:${BUILD_OS}"
+
+docker build -t "$USER_TAG" - <<UserSpecificDocker
+FROM ambari-build:${BUILD_OS}
+RUN groupadd --non-unique -g ${GROUP_ID} ${USER_NAME}
+RUN useradd -g ${GROUP_ID} -u ${USER_ID} -k /root -m ${USER_NAME}
+ENV HOME /home/${USER_NAME}
+UserSpecificDocker
+
+TTY_MODE="-t -i"
+if [ "$#" -gt 0 ]; then
+  TTY_MODE=""
+fi
+
+# By mapping the .m2 directory you can do an mvn install from
+# within the container and use the result on your normal
+# system.  This also allows a significant speedup in subsequent
+# builds, because the dependencies are downloaded only once.
+docker run --rm=true $TTY_MODE \
+  -u "${USER_NAME}" \
+  -h "${BUILD_OS}" \
+  -v "${AMBARI_DIR}:/home/${USER_NAME}/src:delegated" \
+  -v "${HOME}/.m2:/home/${USER_NAME}/.m2:cached" \
+  -w "/home/${USER_NAME}/src" \
+  "$USER_TAG" \
+  "$@"

-- 
To stop receiving notification emails like this one, please contact
adoroszlai@apache.org.

Mime
View raw message