You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by dz...@apache.org on 2021/09/17 12:24:39 UTC

[drill] branch 7999-docker-jdk updated (3b258bd -> bcdf4f5)

This is an automated email from the ASF dual-hosted git repository.

dzamo pushed a change to branch 7999-docker-jdk
in repository https://gitbox.apache.org/repos/asf/drill.git.


 discard 3b258bd  Add #!/bin/bash shebang to build hooks.
 discard b061470  Make the build container base image name an ARG, BUILD_BASE_IMAGE.
 discard 029cc78  Add Apache License to Docker Hub hooks in hooks/
 discard 0d1c3fc  Add openjdk-8 tag to drill:latest, separate version numbers with hyphen, newest = 14.
 discard aa22152  Add hooks/ dir containing hooks for Docker Hub image builder.
 discard f95f8b1  Remove individual module build commands.
 discard 1c725c7  Base the build container on OpenJDK 8 to maintain compat with JDK >= 8
 discard aeb4151  Make the OpenJDK base image name a variable.
 discard d63eb42  Add Apache license to .dockerignore.
 discard 060087e  Base Docker image on maven:3.8.2-jdk-11 and openjdk-11.
     new bcdf4f5  DRILL-7999 Base Docker image on maven:3.8.2-jdk-11 and openjdk-11

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (3b258bd)
            \
             N -- N -- N   refs/heads/7999-docker-jdk (bcdf4f5)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 Dockerfile  | 10 +++++-----
 hooks/build |  8 ++++----
 hooks/push  |  7 ++++---
 3 files changed, 13 insertions(+), 12 deletions(-)

[drill] 01/01: DRILL-7999 Base Docker image on maven:3.8.2-jdk-11 and openjdk-11

Posted by dz...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dzamo pushed a commit to branch 7999-docker-jdk
in repository https://gitbox.apache.org/repos/asf/drill.git

commit bcdf4f5b7aa3e7b0e670f9afa032933d60b7aaa0
Author: James Turton <ja...@somecomputer.xyz>
AuthorDate: Thu Sep 2 12:05:42 2021 +0200

    DRILL-7999 Base Docker image on maven:3.8.2-jdk-11 and openjdk-11
    
    Add Apache license to .dockerignore.
    
    Make the OpenJDK base image name a variable.
    
    This allows using a single Dockerfile to target a variety of OpenJDK versions.
    
    Base the build container on OpenJDK 8 to maintain compat with JDK >= 8
    
    Remove individual module build commands.
    
    I had hoped these module build layers would be an optimisation but
    I now think they result in Maven doing rework rather than building
    incrementally.
    
    Add hooks/ dir containing hooks for Docker Hub image builder.
    
    See the committed README for more information.
    
    Add openjdk-8 tag to drill:latest, separate version numbers with hyphen, newest = 14.
    
    Add Apache License to Docker Hub hooks in hooks/
    
    Make the build container base image name an ARG, BUILD_BASE_IMAGE.
    
    Add #!/bin/bash shebang to build hooks.
    
    Base image tags on Docker Hub env var $DOCKER_TAG.
---
 .dockerignore | 27 +++++++++++++++++++++++++++
 Dockerfile    | 43 ++++++++++++++++++++++++++++++++-----------
 hooks/README  |  9 +++++++++
 hooks/build   | 39 +++++++++++++++++++++++++++++++++++++++
 hooks/push    | 23 +++++++++++++++++++++++
 5 files changed, 130 insertions(+), 11 deletions(-)

diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..aabd129
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,27 @@
+#
+# 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.
+
+.dockerignore
+Dockerfile
+.git
+**/.project
+
+# The top-level Dockerfile does its own Maven build so we don't want
+# **/target.  See distribution/Dockerfile for a Dockerfile that
+# builds an image using binaries copied from distribution/target.
+
+**/target
diff --git a/Dockerfile b/Dockerfile
index cfe3a2d..ee70ed4 100755
--- a/Dockerfile
+++ b/Dockerfile
@@ -16,19 +16,35 @@
 # limitations under the License.
 #
 
-# This Dockerfile is used for automated builds in DockerHub. It adds project sources into the build image, builds
-# Drill and copies built binaries into the target image based on openjdk:8u232-jdk image.
+# This Dockerfile is used for automated builds in DockerHub. It adds
+# project sources into the build image, builds Drill and copies built
+# binaries into the target image.
 
-# Uses intermediate image for building Drill to reduce target image size
-FROM maven:3.6.3-jdk-8 as build
+# Example usage:
+#
+# {docker|podman} build \
+#    --build-arg BUILD_BASE_IMAGE=maven:3.8.2-openjdk-11 \
+#    --build-arg BASE_IMAGE=openjdk:11-jre \
+#    -t apache/drill-openjdk-11 
 
-# Copy project sources into the container
-COPY . /src
+# Unless otherwise specified, the intermediate container image will be 
+# based on the following default.
+ARG BUILD_BASE_IMAGE=maven:3.8.2-openjdk-8
+
+# Unless otherwise specified, the final container image will be based on
+# the following default.
+ARG BASE_IMAGE=openjdk:8-jre
+
+# Uses intermediate image for building Drill to reduce target image size
+FROM $BUILD_BASE_IMAGE as build
 
 WORKDIR /src
 
+# Copy project sources into the container
+COPY . .
+
 # Builds Drill
-RUN  mvn clean install -DskipTests -q
+RUN mvn -Dmaven.artifact.threads=5 -T1C clean install -DskipTests
 
 # Get project version and copy built binaries into /opt/drill directory
 RUN VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) \
@@ -36,11 +52,16 @@ RUN VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --n
  && mv distribution/target/apache-drill-${VERSION}/apache-drill-${VERSION}/* /opt/drill
 
 # Target image
-FROM openjdk:8u232-jdk
 
-RUN mkdir /opt/drill
+# Set the BASE_IMAGE build arg when you invoke docker build.  
+FROM $BASE_IMAGE
+
+ENV DRILL_HOME=/opt/drill
 
-COPY --from=build /opt/drill /opt/drill
+RUN mkdir $DRILL_HOME
+
+COPY --from=build /opt/drill $DRILL_HOME
 
 # Starts Drill in embedded mode and connects to Sqlline
-ENTRYPOINT /opt/drill/bin/drill-embedded
+ENTRYPOINT $DRILL_HOME/bin/drill-embedded
+
diff --git a/hooks/README b/hooks/README
new file mode 100644
index 0000000..53f7b03
--- /dev/null
+++ b/hooks/README
@@ -0,0 +1,9 @@
+This directory exists for Docker Hub's automatic image building. The hooks 
+here override the default build, test and push commands used by Docker Hub
+to build the published Docker images of Drill.  The reason they are overridden
+is so that we can produce Docker images based on multiple OpenJDK base images,
+all using a single Dockerfile.  Also see
+
+../Dockerfile
+https://docs.docker.com/docker-hub/builds/advanced/
+
diff --git a/hooks/build b/hooks/build
new file mode 100755
index 0000000..2e4c99c
--- /dev/null
+++ b/hooks/build
@@ -0,0 +1,39 @@
+#!/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.
+
+docker build \
+	--build-arg BUILD_BASE_IMAGE=maven:3.8.2-openjdk-8 \
+	--build-arg BASE_IMAGE=openjdk:8-jre \
+	-t apache/drill:$DOCKER_TAG-openjdk-8 \
+	-t apache/drill:$DOCKER_TAG \
+	.
+
+docker build \
+	--build-arg BUILD_BASE_IMAGE=maven:3.8.2-openjdk-11 \
+	--build-arg BASE_IMAGE=openjdk:11-jre \
+	-t apache/drill:$DOCKER_TAG-openjdk-11 \
+	.
+
+# Maven images in Docker Hub jump from OpenJDK 11 to OpenJDK 16 so we build
+# with OpenJDK 11 for the OpenJDK 14-based container.
+
+docker build \
+	--build-arg BUILD_BASE_IMAGE=maven:3.8.2-openjdk-11 \
+	--build-arg BASE_IMAGE=openjdk:14 \
+	-t apache/drill:$DOCKER_TAG-openjdk-14 \
+	.
diff --git a/hooks/push b/hooks/push
new file mode 100755
index 0000000..69aa52c
--- /dev/null
+++ b/hooks/push
@@ -0,0 +1,23 @@
+#!/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.
+
+docker push apache/drill:$DOCKER_TAG
+docker push apache/drill:$DOCKER_TAG-openjdk-8
+docker push apache/drill:$DOCKER_TAG-openjdk-11
+docker push apache/drill:$DOCKER_TAG-openjdk-14
+