diff --git a/README.md b/README.md index 7c939bc6e902..6e08e79f4ca7 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 + +``` + + diff --git a/dev-tools/docker/base/Dockerfile b/dev-tools/docker/base/Dockerfile new file mode 100644 index 000000000000..513811ce7989 --- /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 + +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 + 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 000000000000..9aab72c45d63 --- /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 + diff --git a/dev-tools/docker/compile/Dockerfile b/dev-tools/docker/compile/Dockerfile new file mode 100644 index 000000000000..bab74d4e483b --- /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 + +LABEL Vendor="Apache Geode (incubating)" +LABEL version=unstable 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 000000000000..9059c5b5bbff --- /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}" - < +# 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 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"] + diff --git a/docker/README.md b/docker/README.md index 46929407d24e..2c1e31a34575 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 ``` diff --git a/docker/build-runtime-docker.sh b/docker/build-runtime-docker.sh new file mode 100755 index 000000000000..40fef678b138 --- /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 +