Created
July 15, 2020 18:41
-
-
Save andrwng/f053dbbb48e38746ba91903db191c1a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 4d2ed5ca7b18c0883242e4596374483cd5a9e68c | |
Author: Andrew Wong <awong@cloudera.com> | |
Date: Tue Jul 7 21:10:49 2020 -0700 | |
docker: build the website | |
Adds a docs_build image that includes most of the required pieces for | |
running make_site.sh. | |
Some manual steps are still needed, e.g. before running anything, I | |
manually copied my local .git folder into the container, since the | |
scripts expect to be running in a git repository and need to check out | |
gh-pages. Additionally, it's probably easiest for the built docs need to | |
be manually copied to the local filesystem for the user to submit to | |
gerrit. | |
Change-Id: If26183fa731ec0280ac9a4f0911ca5e85d554346 | |
diff --git a/docker/Dockerfile b/docker/Dockerfile | |
index b51cf7243..f3299093b 100644 | |
--- a/docker/Dockerfile | |
+++ b/docker/Dockerfile | |
@@ -524,3 +524,106 @@ LABEL name="Apache Impala" \ | |
org.label-schema.vcs-type=$VCS_TYPE \ | |
org.label-schema.vcs-url=$VCS_URL \ | |
org.label-schema.version=$VERSION | |
+ | |
+# | |
+# ---- Site Dev ---- | |
+# Builds a base image that has all the development libraries and requirements | |
+# for deploying the Kudu website pre-installed. | |
+# | |
+ARG BASE_OS | |
+FROM $BASE_OS as site_dev | |
+ | |
+COPY ./docker/bootstrap-dev-env.sh / | |
+COPY ./docker/bootstrap-java-env.sh / | |
+COPY ./docker/bootstrap-python-env.sh / | |
+ENV SITE_BUILD=1 | |
+RUN ./bootstrap-dev-env.sh \ | |
+ && ./bootstrap-java-env.sh \ | |
+ && ./bootstrap-python-env.sh \ | |
+ && rm bootstrap-dev-env.sh \ | |
+ && rm bootstrap-java-env.sh \ | |
+ && rm bootstrap-python-env.sh | |
+ | |
+ENV PATH /usr/lib/ccache:/usr/lib64/ccache/:$PATH | |
+ | |
+# Entry point to bash. | |
+CMD ["/bin/bash"] | |
+ | |
+# Common label arguments. | |
+# VCS_REF is not specified to improve docker caching. | |
+ARG DOCKERFILE | |
+ARG MAINTAINER | |
+ARG URL | |
+ARG VCS_TYPE | |
+ARG VCS_URL | |
+ARG VERSION | |
+ | |
+LABEL org.label-schema.name="Apache Kudu Website Deployment Base" \ | |
+ org.label-schema.description="A base image that has all the libraries and requirements to build and deploy the Kudu website pre-installed." \ | |
+ # Common labels. | |
+ org.label-schema.dockerfile=$DOCKERFILE \ | |
+ org.label-schema.maintainer=$MAINTAINER \ | |
+ org.label-schema.url=$URL \ | |
+ org.label-schema.vcs-type=$VCS_TYPE \ | |
+ org.label-schema.vcs-url=$VCS_URL \ | |
+ org.label-schema.version=$VERSION | |
+ | |
+ | |
+FROM site_dev as docs_build | |
+ | |
+ARG UID=1000 | |
+ARG GID=1000 | |
+ARG BUILD_DIR="/kudu" | |
+ARG BIN_DIR=${BUILD_DIR}/build/latest/bin | |
+ | |
+# Setup the kudu user and create the neccessary directories. | |
+# We do this before copying any files othwerwise the image size is doubled by the chown change. | |
+RUN groupadd -g ${GID} kudu || groupmod -n kudu $(getent group ${GID} | cut -d: -f1) \ | |
+ && useradd --shell /bin/bash -u ${UID} -g ${GID} -m kudu \ | |
+ && echo 'kudu ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers \ | |
+ && mkdir -p ${BUILD_DIR} && chown -R kudu:kudu ${BUILD_DIR} | |
+# Run the build as the kudu user. | |
+USER kudu | |
+ | |
+WORKDIR ${BUILD_DIR} | |
+COPY --chown=kudu:kudu --from=build ${BIN_DIR}/kudu-master ${BIN_DIR}/kudu-master | |
+COPY --chown=kudu:kudu --from=build ${BIN_DIR}/kudu-tserver ${BIN_DIR}/kudu-tserver | |
+COPY --chown=kudu:kudu --from=build ${BIN_DIR}/kudu ${BIN_DIR}/kudu | |
+# We only copy the needed files for thirdparty so docker can handle caching. | |
+COPY --chown=kudu:kudu ./thirdparty thirdparty | |
+COPY --chown=kudu:kudu ./build-support/enable_devtoolset.sh \ | |
+ ./build-support/enable_devtoolset_inner.sh \ | |
+ build-support/ | |
+COPY --chown=kudu:kudu ./build-support/ccache-clang build-support/ccache-clang | |
+COPY --chown=kudu:kudu ./build-support/ccache-devtoolset-3 build-support/ccache-devtoolset-3 | |
+# Copy the C++ build source. | |
+# We copy the minimal source to optimize docker cache hits. | |
+COPY --chown=kudu:kudu ./build-support build-support | |
+COPY --chown=kudu:kudu ./cmake_modules cmake_modules | |
+COPY --chown=kudu:kudu ./examples/cpp examples/cpp | |
+COPY --chown=kudu:kudu ./docs docs | |
+COPY --chown=kudu:kudu ./src src | |
+COPY --chown=kudu:kudu ./java java | |
+COPY --chown=kudu:kudu ./CMakeLists.txt ./version.txt ./ | |
+ | |
+# Common label arguments. | |
+# VCS_REF is not specified to improve docker caching. | |
+ARG DOCKERFILE | |
+ARG MAINTAINER | |
+ARG URL | |
+ARG VCS_REF | |
+ARG VCS_TYPE | |
+ARG VCS_URL | |
+ARG VERSION | |
+ | |
+CMD ["/bin/bash"] | |
+LABEL name="Apache Kudu Docs Build" \ | |
+ description="An image that has Kudu's documentation pre-built." \ | |
+ # Common labels. | |
+ org.label-schema.dockerfile=$DOCKERFILE \ | |
+ org.label-schema.maintainer=$MAINTAINER \ | |
+ org.label-schema.url=$URL \ | |
+ org.label-schema.vcs-type=$VCS_TYPE \ | |
+ org.label-schema.vcs-url=$VCS_URL \ | |
+ org.label-schema.version=$VERSION | |
+ | |
diff --git a/docker/bootstrap-dev-env.sh b/docker/bootstrap-dev-env.sh | |
index 8d4fbbca6..ce2402967 100755 | |
--- a/docker/bootstrap-dev-env.sh | |
+++ b/docker/bootstrap-dev-env.sh | |
@@ -89,13 +89,16 @@ if [[ -f "/usr/bin/yum" ]]; then | |
vim | |
# Install docs build libraries. | |
- # Note: Uncomment to include in your dev images. These are excluded to reduce image size and build time. | |
- # yum install -y \ | |
- # doxygen \ | |
- # gem \ | |
- # graphviz \ | |
- # ruby-devel \ | |
- # zlib-devel | |
+ # NOTE: pass in 'SITE_BUILD=1' to include dependencies for building the | |
+ # website. These may be excluded to reduce image size and build time. | |
+ if [[ "$SITE_BUILD" == 1 ]]; then | |
+ yum install -y \ | |
+ doxygen \ | |
+ gem \ | |
+ graphviz \ | |
+ ruby-devel \ | |
+ zlib-devel | |
+ fi | |
# To build on a version older than 7.0, the Red Hat Developer Toolset | |
# must be installed (in order to have access to a C++11 capable compiler). | |
@@ -169,14 +172,17 @@ elif [[ -f "/usr/bin/apt-get" ]]; then | |
vim | |
# Install docs build libraries. | |
- # Note: Uncomment to include in your dev images. These are excluded to reduce image size and build time. | |
- # apt-get install -y --no-install-recommends \ | |
- # doxygen \ | |
- # gem \ | |
- # graphviz \ | |
- # ruby-dev \ | |
- # xsltproc \ | |
- # zlib1g-dev | |
+ # NOTE: pass in 'SITE_BUILD=1' to include dependencies for building the | |
+ # website. These may be excluded to reduce image size and build time. | |
+ if [[ "$SITE_BUILD" == 1 ]]; then | |
+ apt-get install -y --no-install-recommends \ | |
+ doxygen \ | |
+ gem \ | |
+ graphviz \ | |
+ ruby-dev \ | |
+ xsltproc \ | |
+ zlib1g-dev | |
+ fi | |
# Reduce the image size by cleaning up after the install. | |
apt-get clean | |
@@ -186,4 +192,4 @@ elif [[ -f "/usr/bin/apt-get" ]]; then | |
else | |
echo "Unsupported OS" | |
exit 1 | |
-fi | |
\ No newline at end of file | |
+fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment