You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by up...@apache.org on 2015/10/17 00:00:09 UTC

[2/2] incubator-geode git commit: GEODE-60: Scripts to build geode in a docker environment.

GEODE-60: Scripts to build geode in a docker environment.

Contribution from Jun Aoki.

Splitting the existing Dockerfile for running geode into a base
Dockerfile, a Dockerfile for users to run geode, and a Dockerfile to
compile geode and run tests within docker.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/23cab238
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/23cab238
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/23cab238

Branch: refs/heads/develop
Commit: 23cab238ecb268aea0cd13d8dc14425d992445b2
Parents: 1cb906c
Author: Dan Smith <up...@apache.org>
Authored: Wed Oct 14 14:56:51 2015 -0700
Committer: Dan Smith <up...@apache.org>
Committed: Fri Oct 16 14:59:16 2015 -0700

----------------------------------------------------------------------
 README.md                                       |  9 +++
 dev-tools/docker/base/Dockerfile                | 54 +++++++++++++++++
 dev-tools/docker/base/build-base-docker.sh      | 30 ++++++++++
 dev-tools/docker/compile/Dockerfile             | 21 +++++++
 .../docker/compile/start-compile-docker.sh      | 62 ++++++++++++++++++++
 docker/Dockerfile                               | 56 ++++++++----------
 docker/README.md                                |  6 +-
 docker/build-runtime-docker.sh                  | 32 ++++++++++
 8 files changed, 234 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/23cab238/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 7c939bc..6e08e79 100755
--- a/README.md
+++ b/README.md
@@ -88,3 +88,12 @@ Geode applications can be written in a number of client technologies:
 * [Python](https://github.com/gemfire/py-gemfire-rest)
 * [REST](http://geode-docs.cfapps.io/docs/geode_rest/book_intro.html)
 * [[memcached|Moving from memcached to gemcached]]
+
+
+# Build environment in Docker
+```
+dev-tools/docker/compile/start-compile-docker.sh
+
+```
+
+

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/23cab238/dev-tools/docker/base/Dockerfile
----------------------------------------------------------------------
diff --git a/dev-tools/docker/base/Dockerfile b/dev-tools/docker/base/Dockerfile
new file mode 100644
index 0000000..513811c
--- /dev/null
+++ b/dev-tools/docker/base/Dockerfile
@@ -0,0 +1,54 @@
+# 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 centos:centos7
+MAINTAINER Geode Community <de...@geode.incubator.apache.org>
+
+LABEL Vendor="Apache Geode (incubating)"
+LABEL version=unstable
+
+# download JDK 8
+ENV	JAVA_HOME /jdk1.8.0_51
+
+RUN	yum install -y wget which tar git \
+	&& wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u51-b16/jdk-8u51-linux-x64.tar.gz" \
+	&& tar xf jdk-8u51-linux-x64.tar.gz \
+	&& rm -rf $JAVA_HOME/*src.zip \
+						$JAVA_HOME/lib/missioncontrol \
+						$JAVA_HOME/lib/visualvm \
+						$JAVA_HOME/lib/*javafx* \
+						$JAVA_HOME/jre/lib/plugin.jar \
+						$JAVA_HOME/jre/lib/ext/jfxrt.jar \
+						$JAVA_HOME/jre/bin/javaws \
+						$JAVA_HOME/jre/lib/javaws.jar \
+						$JAVA_HOME/jre/lib/desktop \
+						$JAVA_HOME/jre/plugin \
+						$JAVA_HOME/jre/lib/deploy* \
+						$JAVA_HOME/jre/lib/*javafx* \
+						$JAVA_HOME/jre/lib/*jfx* \
+						$JAVA_HOME/jre/lib/amd64/libdecora_sse.so \
+						$JAVA_HOME/jre/lib/amd64/libprism_*.so \
+						$JAVA_HOME/jre/lib/amd64/libfxplugins.so \
+						$JAVA_HOME/jre/lib/amd64/libglass.so \
+						$JAVA_HOME/jre/lib/amd64/libgstreamer-lite.so \
+						$JAVA_HOME/jre/lib/amd64/libjavafx*.so \
+						$JAVA_HOME/jre/lib/amd64/libjfx*.so \
+						jdk-8u51-linux-x64.tar.gz \
+						/usr/share/locale/* \
+	&& yum clean all
+
+ENV PATH $PATH:$JAVA_HOME/bin
+

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/23cab238/dev-tools/docker/base/build-base-docker.sh
----------------------------------------------------------------------
diff --git a/dev-tools/docker/base/build-base-docker.sh b/dev-tools/docker/base/build-base-docker.sh
new file mode 100755
index 0000000..9aab72c
--- /dev/null
+++ b/dev-tools/docker/base/build-base-docker.sh
@@ -0,0 +1,30 @@
+#!/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.
+
+set -e -x -u
+
+BASE_SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+
+export DOCKER_ENV_VERSION="0.1"
+export BASE_IMAGE_NAME="geode/base:${DOCKER_ENV_VERSION}"
+
+pushd ${BASE_SCRIPT_DIR}
+
+docker build --rm=true -t ${BASE_IMAGE_NAME} .
+
+popd
+

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/23cab238/dev-tools/docker/compile/Dockerfile
----------------------------------------------------------------------
diff --git a/dev-tools/docker/compile/Dockerfile b/dev-tools/docker/compile/Dockerfile
new file mode 100644
index 0000000..bab74d4
--- /dev/null
+++ b/dev-tools/docker/compile/Dockerfile
@@ -0,0 +1,21 @@
+# 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 geode/base:0.1
+MAINTAINER Geode Community <de...@geode.incubator.apache.org>
+
+LABEL Vendor="Apache Geode (incubating)"
+LABEL version=unstable

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/23cab238/dev-tools/docker/compile/start-compile-docker.sh
----------------------------------------------------------------------
diff --git a/dev-tools/docker/compile/start-compile-docker.sh b/dev-tools/docker/compile/start-compile-docker.sh
new file mode 100755
index 0000000..9059c5b
--- /dev/null
+++ b/dev-tools/docker/compile/start-compile-docker.sh
@@ -0,0 +1,62 @@
+#!/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.
+
+set -e -x -u
+
+SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+
+source ${SCRIPT_DIR}/../base/build-base-docker.sh
+
+IMAGE_NAME="geode/compile:${DOCKER_ENV_VERSION}"
+
+pushd ${SCRIPT_DIR}
+
+docker build -t ${IMAGE_NAME} .
+
+popd
+
+if [ "$(uname -s)" == "Linux" ]; then
+  USER_NAME=${SUDO_USER:=$USER}
+  USER_ID=$(id -u "${USER_NAME}")
+  GROUP_ID=$(id -g "${USER_NAME}")
+else # boot2docker uid and gid
+  USER_NAME=$USER
+  USER_ID=1000
+  GROUP_ID=50
+fi
+
+docker build -t "${IMAGE_NAME}-${USER_NAME}" - <<UserSpecificDocker
+FROM ${IMAGE_NAME} 
+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
+
+# Go to root
+pushd ${SCRIPT_DIR}/../../..
+
+docker run -i -t \
+  --rm=true \
+  -w "/home/${USER_NAME}/incubator-geode" \
+  -u "${USER_NAME}" \
+  -v "$PWD:/home/${USER_NAME}/incubator-geode" \
+  -v "/home/${USER_NAME}/.m2:/home/${USER_NAME}/.m2" \
+  ${IMAGE_NAME}-${USER_NAME} \
+  bash
+
+popd
+

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/23cab238/docker/Dockerfile
----------------------------------------------------------------------
diff --git a/docker/Dockerfile b/docker/Dockerfile
index ecdd712..e7d0ba0 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -1,48 +1,38 @@
-FROM centos:latest
-MAINTAINER William Markito <wi...@gmail.com>
+# 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 geode/base:0.1
+MAINTAINER Geode Community <de...@geode.incubator.apache.org>
 
 LABEL Vendor="Apache Geode (incubating)"
 LABEL version=unstable
 
 # download JDK 8
-ENV	JAVA_HOME /jdk1.8.0_51
+# ENV	JAVA_HOME /jdk1.8.0_51
 
-RUN	yum install -y wget which tar git \
-	&& wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u51-b16/jdk-8u51-linux-x64.tar.gz" \
-	&& tar xf jdk-8u51-linux-x64.tar.gz \
-	&& git clone -b develop https://github.com/apache/incubator-geode.git \
+RUN	git clone -b develop https://github.com/apache/incubator-geode.git \
 	&& cd incubator-geode \
 	&& ./gradlew build -Dskip.tests=true \
 	&& ls /incubator-geode | grep -v gemfire-assembly | xargs rm -rf \
 	&& rm -rf /root/.gradle/ \
 	&& rm -rf /incubator-geode/gemfire-assembly/build/distributions/ \
-	&& rm -rf /jdk-8u51-linux-x64.tar.gz \
-	&& rm -rf $JAVA_HOME/*src.zip \
-						$JAVA_HOME/lib/missioncontrol \
-						$JAVA_HOME/lib/visualvm \
-						$JAVA_HOME/lib/*javafx* \
-						$JAVA_HOME/jre/lib/plugin.jar \
-						$JAVA_HOME/jre/lib/ext/jfxrt.jar \
-						$JAVA_HOME/jre/bin/javaws \
-						$JAVA_HOME/jre/lib/javaws.jar \
-						$JAVA_HOME/jre/lib/desktop \
-						$JAVA_HOME/jre/plugin \
-						$JAVA_HOME/jre/lib/deploy* \
-						$JAVA_HOME/jre/lib/*javafx* \
-						$JAVA_HOME/jre/lib/*jfx* \
-						$JAVA_HOME/jre/lib/amd64/libdecora_sse.so \
-						$JAVA_HOME/jre/lib/amd64/libprism_*.so \
-						$JAVA_HOME/jre/lib/amd64/libfxplugins.so \
-						$JAVA_HOME/jre/lib/amd64/libglass.so \
-						$JAVA_HOME/jre/lib/amd64/libgstreamer-lite.so \
-						$JAVA_HOME/jre/lib/amd64/libjavafx*.so \
-						$JAVA_HOME/jre/lib/amd64/libjfx*.so \
-	&& rm -rf /usr/share/locale/* \
-	&& yum remove -y perl \
-	&& yum clean all
+    && yum remove -y perl
 
 ENV GEODE_HOME /incubator-geode/gemfire-assembly/build/install/apache-geode
-ENV PATH $PATH:$GEODE_HOME/bin:$JAVA_HOME/bin
+ENV PATH $PATH:$GEODE_HOME/bin
 
 # Default ports:
 # RMI/JMX 1099
@@ -53,4 +43,4 @@ ENV PATH $PATH:$GEODE_HOME/bin:$JAVA_HOME/bin
 EXPOSE  8080 10334 40404 1099 7070
 VOLUME ["/data/"]
 CMD ["gfsh"]
-#ENTRYPOINT ["gfsh"]
+

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/23cab238/docker/README.md
----------------------------------------------------------------------
diff --git a/docker/README.md b/docker/README.md
index 4692940..2c1e31a 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -1,9 +1,9 @@
 # Building the container image
 
-The current Dockerfile is based on a CentOS 6 image, downloads JDK 8, clone the Apache Geode git repository, starts a build and execute the basic tests.
+The current Dockerfile is based on a CentOS 7 image, downloads JDK 8, clone the Apache Geode git repository, starts a build and execute the basic tests.
 
 ```
-docker build -t apachegeode/geode:unstable .
+./build-runtime-docker.sh
 ```
 
 This may take a while depending on your internet connection, but it's worth since this is a one time step and you endup with a container that is tested and ready to be used for development. It will download Gradle and as part of the build, project dependencies as well.
@@ -13,7 +13,7 @@ This may take a while depending on your internet connection, but it's worth sinc
 1. Then you can start gfsh as well in order to perform more commands:
 
 ```
-docker run -it -p 10334:10334 -p 7575:7575 -p 1099:1099  apachegeode/geode:unstable gfsh
+docker run --rm=true -it -p 10334:10334 -p 7575:7575 -p 1099:1099  geode/runtime:0.1 gfsh
 ```
 
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/23cab238/docker/build-runtime-docker.sh
----------------------------------------------------------------------
diff --git a/docker/build-runtime-docker.sh b/docker/build-runtime-docker.sh
new file mode 100755
index 0000000..40fef67
--- /dev/null
+++ b/docker/build-runtime-docker.sh
@@ -0,0 +1,32 @@
+#!/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.
+
+set -e -x -u
+
+SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+
+source ${SCRIPT_DIR}/../dev-tools/docker/base/build-base-docker.sh
+
+IMAGE_NAME="geode/runtime:${DOCKER_ENV_VERSION}"
+
+pushd ${SCRIPT_DIR}
+
+# Build runtime image
+docker build --rm=true -t ${IMAGE_NAME} .
+
+popd
+