Repository: geode Updated Branches: refs/heads/feature/GEODE-3423 [created] b20b49308
GEODE-3423: Provide support for running parallel docker builds in Jenkins - Also cleaning up other Dockerfiles which are unused Signed-off-by: Scott Jewell <sje...@pivotal.io> Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/b20b4930 Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/b20b4930 Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/b20b4930 Branch: refs/heads/feature/GEODE-3423 Commit: b20b49308808aed9c8c8fdde1226649956ba9e0b Parents: acdf2e8 Author: Jens Deppe <jde...@pivotal.io> Authored: Thu Aug 10 10:22:17 2017 -0700 Committer: Scott Jewell <sje...@pivotal.io> Committed: Thu Aug 10 10:22:17 2017 -0700 ---------------------------------------------------------------------- dev-tools/docker/base/Dockerfile | 42 +++++-------- dev-tools/docker/base/build-base-docker.sh | 4 +- dev-tools/docker/base/entrypoint.sh | 29 +++++++++ dev-tools/docker/compile/Dockerfile | 21 ------- .../docker/compile/start-compile-docker.sh | 62 -------------------- gradle/docker.gradle | 12 ++-- 6 files changed, 52 insertions(+), 118 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/geode/blob/b20b4930/dev-tools/docker/base/Dockerfile ---------------------------------------------------------------------- diff --git a/dev-tools/docker/base/Dockerfile b/dev-tools/docker/base/Dockerfile index 1cce0dd..4ba74bc 100644 --- a/dev-tools/docker/base/Dockerfile +++ b/dev-tools/docker/base/Dockerfile @@ -21,34 +21,20 @@ LABEL Vendor="Apache Geode" 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 JAVA_HOME /jdk1.8.0_144 + +RUN yum install -y wget which tar git +RUN 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/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz" +RUN tar xf jdk-8u144-linux-x64.tar.gz +RUN rm jdk-8u144-linux-x64.tar.gz +RUN yum clean all ENV PATH $PATH:$JAVA_HOME/bin +RUN curl -L -o /usr/local/bin/gosu https://github.com/tianon/gosu/releases/download/1.10/gosu-amd64 +RUN chmod +x /usr/local/bin/gosu + +COPY entrypoint.sh /usr/local/bin/entrypoint.sh + +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] + http://git-wip-us.apache.org/repos/asf/geode/blob/b20b4930/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 index 9aab72c..d2d17fc 100755 --- a/dev-tools/docker/base/build-base-docker.sh +++ b/dev-tools/docker/base/build-base-docker.sh @@ -19,8 +19,8 @@ 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}" +export DOCKER_ENV_VERSION="latest" +export BASE_IMAGE_NAME="apachegeode/geode-build:${DOCKER_ENV_VERSION}" pushd ${BASE_SCRIPT_DIR} http://git-wip-us.apache.org/repos/asf/geode/blob/b20b4930/dev-tools/docker/base/entrypoint.sh ---------------------------------------------------------------------- diff --git a/dev-tools/docker/base/entrypoint.sh b/dev-tools/docker/base/entrypoint.sh new file mode 100755 index 0000000..a234027 --- /dev/null +++ b/dev-tools/docker/base/entrypoint.sh @@ -0,0 +1,29 @@ +#!/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. + +# This script exists so that this container can bind mount local volumes +# and create files with the same userid as is launching the docker container. +# Typical usage would be: +# LOCAL_USER_ID=`id -u $USER` docker run -ti apachegeode/build + +USER_ID=${LOCAL_USER_ID:-9001} + +useradd --shell /bin/bash -u $USER_ID -o -c "" -m build +export HOME=/home/build + +exec /usr/local/bin/gosu build "$@" \ No newline at end of file http://git-wip-us.apache.org/repos/asf/geode/blob/b20b4930/dev-tools/docker/compile/Dockerfile ---------------------------------------------------------------------- diff --git a/dev-tools/docker/compile/Dockerfile b/dev-tools/docker/compile/Dockerfile deleted file mode 100644 index 6ae343a..0000000 --- a/dev-tools/docker/compile/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -# 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 <d...@geode.apache.org> - -LABEL Vendor="Apache Geode" -LABEL version=unstable http://git-wip-us.apache.org/repos/asf/geode/blob/b20b4930/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 deleted file mode 100755 index 9059c5b..0000000 --- a/dev-tools/docker/compile/start-compile-docker.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/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/geode/blob/b20b4930/gradle/docker.gradle ---------------------------------------------------------------------- diff --git a/gradle/docker.gradle b/gradle/docker.gradle index 7971974..d4828e4 100644 --- a/gradle/docker.gradle +++ b/gradle/docker.gradle @@ -58,6 +58,7 @@ def dockerConfig = { argsInspect = { List args -> def javaHomeIdx = 0 + def pathIdx = 0 def i = args.iterator() def j = 0 while (i.hasNext()) { @@ -67,15 +68,16 @@ def dockerConfig = { if (x.startsWith('JAVA_HOME')) { javaHomeIdx = j } + if (x.startsWith('PATH')) { + pathIdx = j + } } j++ } - // Remove JAVA_HOME env variable - it might not be the same as the container needs - if (javaHomeIdx > 0) { - args.removeAt(javaHomeIdx-1) - args.removeAt(javaHomeIdx-1) - } + // Remove JAVA_HOME and PATH env variables - they might not be the same as the container needs + args[javaHomeIdx] = 'JAVA_HOME_REMOVED=' + args[pathIdx] = 'PATH_REMOVED=' // Infer the index of this invocation def matcher = (args[args.size - 1] =~ /.*Executor (\d*).*/)