Adding a docker container to build and view the geode docs
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/bc7a675a Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/bc7a675a Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/bc7a675a Branch: refs/heads/develop Commit: bc7a675a7c2d819c5d99f070d29e485cf1c0ad64 Parents: e130e5b Author: Dan Smith <upthewatersp...@apache.org> Authored: Fri Oct 14 17:54:12 2016 -0700 Committer: Dan Smith <upthewatersp...@apache.org> Committed: Wed Oct 19 10:19:16 2016 -0700 ---------------------------------------------------------------------- dev-tools/docker/docs/Dockerfile | 25 ++++++++++ dev-tools/docker/docs/build-docs.sh | 32 +++++++++++++ dev-tools/docker/docs/build-image-common.sh | 61 ++++++++++++++++++++++++ dev-tools/docker/docs/view-docs.sh | 35 ++++++++++++++ 4 files changed, 153 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bc7a675a/dev-tools/docker/docs/Dockerfile ---------------------------------------------------------------------- diff --git a/dev-tools/docker/docs/Dockerfile b/dev-tools/docker/docs/Dockerfile new file mode 100644 index 0000000..67a31f4 --- /dev/null +++ b/dev-tools/docker/docs/Dockerfile @@ -0,0 +1,25 @@ +# 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 ruby:2.3.0 +MAINTAINER Geode Community <d...@geode.incubator.apache.org> + +LABEL Vendor="Apache Geode (incubating)" +LABEL version=unstable + +ADD Gemfile Gemfile +ADD Gemfile.lock Gemfile.lock +RUN bundle install http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bc7a675a/dev-tools/docker/docs/build-docs.sh ---------------------------------------------------------------------- diff --git a/dev-tools/docker/docs/build-docs.sh b/dev-tools/docker/docs/build-docs.sh new file mode 100755 index 0000000..4b670b0 --- /dev/null +++ b/dev-tools/docker/docs/build-docs.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/build-image-common.sh + +docker run -i -t \ + --rm=true \ + -w "/home/${USER_NAME}/incubator-geode/geode-book" \ + -u "${USER_NAME}" \ + -v "$PWD:/home/${USER_NAME}/incubator-geode" \ + -v "/home/${USER_NAME}/.m2:/home/${USER_NAME}/.m2" \ + ${IMAGE_NAME}-${USER_NAME} \ + bundle exec bookbinder bind local + +popd + http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bc7a675a/dev-tools/docker/docs/build-image-common.sh ---------------------------------------------------------------------- diff --git a/dev-tools/docker/docs/build-image-common.sh b/dev-tools/docker/docs/build-image-common.sh new file mode 100644 index 0000000..ff0de73 --- /dev/null +++ b/dev-tools/docker/docs/build-image-common.sh @@ -0,0 +1,61 @@ +#!/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 + +export DOCKER_ENV_VERSION="0.1" + +SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) + +#Stupid OSX has a different mktemp command +TMP_DIR=`mktemp -d 2>/dev/null || mktemp -d -t 'geodedocs'` + +function cleanup() { + rm -rf $TMP_DIR +} + +trap cleanup EXIT + +IMAGE_NAME="geode/docsbuild:${DOCKER_ENV_VERSION}" + +pushd ${TMP_DIR} +cp $SCRIPT_DIR/Dockerfile . +cp $SCRIPT_DIR/../../../geode-book/Gemfile* . + +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}/../../../ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bc7a675a/dev-tools/docker/docs/view-docs.sh ---------------------------------------------------------------------- diff --git a/dev-tools/docker/docs/view-docs.sh b/dev-tools/docker/docs/view-docs.sh new file mode 100755 index 0000000..f107ccd --- /dev/null +++ b/dev-tools/docker/docs/view-docs.sh @@ -0,0 +1,35 @@ +#!/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 ) + +. $SCRIPT_DIR/build-image-common.sh + +docker run -i -t \ + --rm=true \ + -w "/home/${USER_NAME}/incubator-geode/geode-book/final_app/public" \ + -u "${USER_NAME}" \ + -v "$PWD:/home/${USER_NAME}/incubator-geode" \ + -v "/home/${USER_NAME}/.m2:/home/${USER_NAME}/.m2" \ + -p 127.0.0.1:8080:8080 \ + ${IMAGE_NAME}-${USER_NAME} \ + python -m SimpleHTTPServer 8080 + +popd +