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 b061470962755519cfdd2c5681ccf65bc30d3e69 Author: James Turton <[email protected]> AuthorDate: Fri Sep 17 10:34:31 2021 +0200 Make the build container base image name an ARG, BUILD_BASE_IMAGE. --- Dockerfile | 25 +++++++++++++++++-------- hooks/build | 23 ++++++++++++++++++++--- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index f2966dd..4daf6cf 100755 --- a/Dockerfile +++ b/Dockerfile @@ -18,15 +18,21 @@ # 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 the image name in BASE_IMAGE -# build arg which you should set when invoking docker build. -# Example syntax: docker build --build-arg BASE_IMAGE="openjdk:8-jre" +# binaries into the target image. -ARG $BASE_IMAGE=openjdk:8-jre +# 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 + +# Unless otherwise specified, the intermediate container image will be +# based on the following default. +ARG BUILD_BASE_IMAGE=maven:3.8.2-openjdk-8 # Uses intermediate image for building Drill to reduce target image size -# Build using OpenJDK 8 to maintain compatibility with all OpenJDK >= 8 -FROM maven:3.8.2-openjdk-8 as build +FROM $BUILD_BASE_IMAGE as build WORKDIR /src @@ -43,6 +49,10 @@ RUN VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --n # Target image +# Unless otherwise specified, the final container image will be based on +# the following default. +ARG BASE_IMAGE=openjdk:8-jre + # Set the BASE_IMAGE build arg when you invoke docker build. FROM $BASE_IMAGE @@ -54,5 +64,4 @@ COPY --from=build /opt/drill $DRILL_HOME # Starts Drill in embedded mode and connects to Sqlline ENTRYPOINT $DRILL_HOME/bin/drill-embedded - - + diff --git a/hooks/build b/hooks/build index c73a76b..94e61db 100755 --- a/hooks/build +++ b/hooks/build @@ -15,7 +15,24 @@ # See the License for the specific language governing permissions and # limitations under the License. -docker build --build-arg BASE_IMAGE=openjdk:8-jre -t apache/drill:openjdk-8 -t apache/drill:latest . -docker build --build-arg BASE_IMAGE=openjdk:11-jre -t apache/drill:openjdk-11 . -docker build --build-arg BASE_IMAGE=openjdk:14 -t apache/drill:openjdk-14 . +docker build \ + --build-arg BUILD_BASE_IMAGE=maven:3.8.2-openjdk-8 \ + --build-arg BASE_IMAGE=openjdk:8-jre \ + -t apache/drill:openjdk-8 \ + -t apache/drill:latest \ + . +docker build \ + --build-arg BUILD_BASE_IMAGE=maven:3.8.2-openjdk-11 \ + --build-arg BASE_IMAGE=openjdk:11-jre \ + -t apache/drill: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:openjdk-14 \ + .
