mirror of
https://github.com/apache/impala.git
synced 2025-12-25 02:03:09 -05:00
IMPALA-9574: support ubuntu 18.04 base image
Automatically detect if we're on Ubuntu 16.04 or 18.04 and use the appropriate base image. Testing: Built an image locally on my Ubuntu 18.04 system and made sure I could start a minicluster and run a query. Change-Id: I8dfdb349e78fd76b91138a70449d51b0ef0021df Reviewed-on: http://gerrit.cloudera.org:8080/15765 Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
This commit is contained in:
committed by
Impala Public Jenkins
parent
2dc2006c9e
commit
c4ba8f8291
@@ -19,77 +19,99 @@ set(IMPALA_BASE_BUILD_CONTEXT_DIR
|
||||
${CMAKE_SOURCE_DIR}/docker/build_context
|
||||
)
|
||||
|
||||
# Add a target to build a base docker image for 'build_type'. 'build_context_args' are
|
||||
# passed to the setup_build_context.py script.
|
||||
function(add_base_image build_type build_context_args)
|
||||
# Build context depends on daemons and frontend jars
|
||||
# Sending the whole impala workspace including test binaries, testdata, etc
|
||||
# to the docker daemon can be very expensive, so we create a build context
|
||||
# with symlinks
|
||||
add_custom_target(impala_base_build_context_${build_type}
|
||||
COMMAND ${CMAKE_SOURCE_DIR}/docker/setup_build_context.py ${build_context_args}
|
||||
DEPENDS daemons fe ${CMAKE_SOURCE_DIR}/docker/setup_build_context.py
|
||||
COMMENT "Creating impala base build context build_type=${build_type}."
|
||||
VERBATIM
|
||||
)
|
||||
# Target for the base Impala image.
|
||||
add_custom_target(impala_base_image_${build_type}
|
||||
# Use tar with -h flag to assemble a tarball including all the symlinked files and
|
||||
# directories in the build context.
|
||||
COMMAND cd ${IMPALA_BASE_BUILD_CONTEXT_DIR}/${build_type} && tar cvh . | docker build -t impala_base_${build_type} -
|
||||
DEPENDS impala_base_build_context_${build_type} ${CMAKE_SOURCE_DIR}/docker/impala_base/Dockerfile
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/docker/daemon_entrypoint.sh
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/bin/graceful_shutdown_backends.sh
|
||||
COMMENT "Building Impala base docker image build_type=${build_type}."
|
||||
VERBATIM
|
||||
)
|
||||
endfunction()
|
||||
add_base_image(release "")
|
||||
add_base_image(debug "--debug-build")
|
||||
find_program(LSB_RELEASE_EXEC lsb_release)
|
||||
execute_process(COMMAND ${LSB_RELEASE_EXEC} -is
|
||||
OUTPUT_VARIABLE LSB_RELEASE_ID
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
execute_process(COMMAND ${LSB_RELEASE_EXEC} -rs
|
||||
OUTPUT_VARIABLE LSB_RELEASE_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
# Target to build all docker images. Dependencies are added for each docker image
|
||||
# instantiated below.
|
||||
add_custom_target(docker_images)
|
||||
add_custom_target(docker_debug_images)
|
||||
if(${LSB_RELEASE_ID} STREQUAL "Ubuntu" AND ${LSB_RELEASE_VERSION} STREQUAL "16.04")
|
||||
set(DISTRO_BASE_IMAGE "ubuntu:16.04")
|
||||
elseif(${LSB_RELEASE_ID} STREQUAL "Ubuntu" AND ${LSB_RELEASE_VERSION} STREQUAL "18.04")
|
||||
set(DISTRO_BASE_IMAGE "ubuntu:18.04")
|
||||
else()
|
||||
set(DISTRO_BASE_IMAGE "UNSUPPORTED")
|
||||
endif()
|
||||
MESSAGE(STATUS "Picked docker base image based on host OS: ${DISTRO_BASE_IMAGE}")
|
||||
|
||||
set(daemon_image_names "")
|
||||
if (NOT ${DISTRO_BASE_IMAGE} STREQUAL "UNSUPPORTED")
|
||||
# Add a target to build a base docker image for 'build_type'. 'build_context_args' are
|
||||
# passed to the setup_build_context.py script.
|
||||
function(add_base_image build_type build_context_args)
|
||||
# Build context depends on daemons and frontend jars
|
||||
# Sending the whole impala workspace including test binaries, testdata, etc
|
||||
# to the docker daemon can be very expensive, so we create a build context
|
||||
# with symlinks
|
||||
add_custom_target(impala_base_build_context_${build_type}
|
||||
COMMAND ${CMAKE_SOURCE_DIR}/docker/setup_build_context.py ${build_context_args}
|
||||
DEPENDS daemons fe ${CMAKE_SOURCE_DIR}/docker/setup_build_context.py
|
||||
COMMENT "Creating impala base build context build_type=${build_type}."
|
||||
VERBATIM
|
||||
)
|
||||
# Target for the base Impala image.
|
||||
add_custom_target(impala_base_image_${build_type}
|
||||
# Use tar with -h flag to assemble a tarball including all the symlinked files and
|
||||
# directories in the build context.
|
||||
COMMAND cd ${IMPALA_BASE_BUILD_CONTEXT_DIR}/${build_type} && tar cvh . | docker build -t impala_base_${build_type} --build-arg BASE_IMAGE=${DISTRO_BASE_IMAGE} -
|
||||
DEPENDS impala_base_build_context_${build_type} ${CMAKE_SOURCE_DIR}/docker/impala_base/Dockerfile
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/docker/daemon_entrypoint.sh
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/bin/graceful_shutdown_backends.sh
|
||||
COMMENT "Building Impala base docker image build_type=${build_type}."
|
||||
VERBATIM
|
||||
)
|
||||
endfunction()
|
||||
add_base_image(release "")
|
||||
add_base_image(debug "--debug-build")
|
||||
|
||||
# Add a target with name 'target' to build a daemon image for the daemon with
|
||||
# name 'daemon_name', e.g. "impalad_executor". The image is tagged as 'image_name'.
|
||||
# 'build_type' should be debug or release and determines which base image is used.
|
||||
function(add_daemon_docker_image target daemon_name image_name build_type)
|
||||
set(build_dir ${CMAKE_SOURCE_DIR}/docker/${daemon_name})
|
||||
add_custom_target(${target}
|
||||
# Supply the appropriate base image as an argument for the Dockerfile.
|
||||
COMMAND cd ${build_dir} && docker build --build-arg BASE_IMAGE=impala_base_${build_type} -t ${image_name} .
|
||||
DEPENDS impala_base_image_${build_type} ${build_dir}/Dockerfile
|
||||
COMMENT "Building ${image_name} docker image."
|
||||
VERBATIM
|
||||
)
|
||||
set(daemon_image_names "${daemon_image_names} ${image_name}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
# Target to build all docker images. Dependencies are added for each docker image
|
||||
# instantiated below.
|
||||
add_custom_target(docker_images)
|
||||
add_custom_target(docker_debug_images)
|
||||
|
||||
# Add debug and release docker image targets for the given daemon e.g. if called
|
||||
# with "statestored", targets "statestored_image" and "statestored_debug_image"
|
||||
# are added.
|
||||
function(add_daemon_docker_images daemon_name)
|
||||
set(release_image ${daemon_name})
|
||||
set(release_target ${daemon_name}_image)
|
||||
set(debug_image ${daemon_name}_debug)
|
||||
set(debug_target ${daemon_name}_debug_image)
|
||||
add_daemon_docker_image(${release_target} ${daemon_name} ${release_image} release)
|
||||
add_daemon_docker_image(${debug_target} ${daemon_name} ${debug_image} debug)
|
||||
ADD_DEPENDENCIES(docker_images ${release_target})
|
||||
ADD_DEPENDENCIES(docker_debug_images ${debug_target})
|
||||
set(daemon_image_names "${daemon_image_names} ${release_image}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
set(daemon_image_names "")
|
||||
|
||||
# Stamp out image targets for all of the Impala daemons.
|
||||
add_daemon_docker_images(impalad_coord_exec)
|
||||
add_daemon_docker_images(impalad_coordinator)
|
||||
add_daemon_docker_images(impalad_executor)
|
||||
add_daemon_docker_images(catalogd)
|
||||
add_daemon_docker_images(statestored)
|
||||
# Add a target with name 'target' to build a daemon image for the daemon with
|
||||
# name 'daemon_name', e.g. "impalad_executor". The image is tagged as 'image_name'.
|
||||
# 'build_type' should be debug or release and determines which base image is used.
|
||||
function(add_daemon_docker_image target daemon_name image_name build_type)
|
||||
set(build_dir ${CMAKE_SOURCE_DIR}/docker/${daemon_name})
|
||||
add_custom_target(${target}
|
||||
# Supply the appropriate base image as an argument for the Dockerfile.
|
||||
COMMAND cd ${build_dir} && docker build --build-arg BASE_IMAGE=impala_base_${build_type} -t ${image_name} .
|
||||
DEPENDS impala_base_image_${build_type} ${build_dir}/Dockerfile
|
||||
COMMENT "Building ${image_name} docker image."
|
||||
VERBATIM
|
||||
)
|
||||
set(daemon_image_names "${daemon_image_names} ${image_name}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Add debug and release docker image targets for the given daemon e.g. if called
|
||||
# with "statestored", targets "statestored_image" and "statestored_debug_image"
|
||||
# are added.
|
||||
function(add_daemon_docker_images daemon_name)
|
||||
set(release_image ${daemon_name})
|
||||
set(release_target ${daemon_name}_image)
|
||||
set(debug_image ${daemon_name}_debug)
|
||||
set(debug_target ${daemon_name}_debug_image)
|
||||
add_daemon_docker_image(${release_target} ${daemon_name} ${release_image} release)
|
||||
add_daemon_docker_image(${debug_target} ${daemon_name} ${debug_image} debug)
|
||||
ADD_DEPENDENCIES(docker_images ${release_target})
|
||||
ADD_DEPENDENCIES(docker_debug_images ${debug_target})
|
||||
set(daemon_image_names "${daemon_image_names} ${release_image}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Stamp out image targets for all of the Impala daemons.
|
||||
add_daemon_docker_images(impalad_coord_exec)
|
||||
add_daemon_docker_images(impalad_coordinator)
|
||||
add_daemon_docker_images(impalad_executor)
|
||||
add_daemon_docker_images(catalogd)
|
||||
add_daemon_docker_images(statestored)
|
||||
|
||||
# Generate a text file with all of the release daemon images.
|
||||
file(WRITE ${CMAKE_SOURCE_DIR}/docker/docker-images.txt "${daemon_image_names}")
|
||||
endif()
|
||||
|
||||
# Generate a text file with all of the release daemon images.
|
||||
file(WRITE ${CMAKE_SOURCE_DIR}/docker/docker-images.txt "${daemon_image_names}")
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
FROM ubuntu:16.04
|
||||
ARG BASE_IMAGE=ubuntu:16.04
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
# Install minimal dependencies required for Impala services to run.
|
||||
# liblzo2-2 may be needed by the Impala-lzo plugin, which is used in tests.
|
||||
|
||||
Reference in New Issue
Block a user