Bordeaux is a voice application server for modern IP telephony networks using modern C++ practices along with advances originally made in GNU Bayonne.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

81 lines
2.9 KiB

# Configure docker targets
# Copyright (C) 2021 David Sugar <tychosoft@gmail.com>.
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
find_program(DOCKER_EXEC NAMES docker podman)
set(SOURCES_TAR "${CMAKE_CURRENT_BINARY_DIR}/out/sources.tar")
file(REMOVE "${SOURCES_TAR}")
if(NOT DEFINED DOCKER_TAG)
set(DOCKER_TAG "latest")
endif()
if(NOT DEFINED DOCKER_REGISTRY)
set(DOCKER_REGISTRY "local")
endif()
if(NOT DEFINED DOCKER_PLATFORMS)
set(DOCKER_PLATFORMS "linux/amd64,linux/arm64")
endif()
if(NOT DEFINED DOCKER_DEPLOY)
set(DOCKER_DEPLOY "quay.io/gnutelephony/bordeaux")
endif()
add_custom_target(docker-sources
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMAND "${CMAKE_COMMAND}" -E make_directory out
COMMAND "${CMAKE_COMMAND}" -E remove -f "${SOURCES_TAR}"
COMMAND git archive -o "${SOURCES_TAR}" --format tar HEAD
)
add_custom_target(docker-generic
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
DEPENDS docker-sources
USES_TERMINAL
COMMAND "${DOCKER_EXEC}" build --build-arg DRIVER="generic" --squash -t "${DOCKER_REGISTRY}/bordeaux-generic:${DOCKER_TAG}" "${CMAKE_CURRENT_SOURCE_DIR}"
)
add_custom_target(docker-coventry
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
DEPENDS docker-sources
USES_TERMINAL
COMMAND "${DOCKER_EXEC}" build --build-arg DRIVER="coventry" --squash -t "${DOCKER_REGISTRY}/bordeaux-coventry:${DOCKER_TAG}" "${CMAKE_CURRENT_SOURCE_DIR}"
)
add_custom_target(buildx-generic
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
DEPENDS docker-sources
USES_TERMINAL
COMMAND "${DOCKER_EXEC}" buildx build --platform "${DOCKER_PLATFORMS}" --build-arg DRIVER="generic" --push -t "${DOCKER_DEPLOY}-generic:${DOCKER_TAG}" "${CMAKE_CURRENT_SOURCE_DIR}"
)
add_custom_target(buildx-coventry
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
DEPENDS docker-sources
USES_TERMINAL
COMMAND "${DOCKER_EXEC}" buildx build --platform "${DOCKER_PLATFORMS}" --build-arg DRIVER="coventry" --push -t "${DOCKER_DEPLOY}-coventry:${DOCKER_TAG}" "${CMAKE_CURRENT_SOURCE_DIR}"
)
add_custom_target(docker-inspect
COMMAND "${DOCKER_EXEC}" buildx imagetools inspect "${DOCKER_DEPLOY}-generic"
COMMAND "${DOCKER_EXEC}" buildx imagetools inspect "${DOCKER_DEPLOY}-coventry"
)
add_custom_target(docker-images
DEPENDS docker-generic docker-coventry
COMMAND "${CMAKE_COMMAND}" -E remove -f "${SOURCES_TAR}"
)
add_custom_target(docker-publish
DEPENDS buildx-generic buildx-coventry
COMMAND "${CMAKE_COMMAND}" -E remove -f "${SOURCES_TAR}"
)