diff --git a/.dockerignore b/.dockerignore --- a/.dockerignore +++ b/.dockerignore @@ -17,7 +17,7 @@ !native/.flowconfig !native/ios/Podfile !native/ios/pod-patch -!native/cpp/CommonCpp/grpc/protos +!native/cpp/CommonCpp/grpc web/node_modules web/dist diff --git a/services/lib/docker/build_service.sh b/services/lib/docker/build_service.sh --- a/services/lib/docker/build_service.sh +++ b/services/lib/docker/build_service.sh @@ -3,21 +3,9 @@ set -e # folly hack - https://github.com/facebook/folly/pull/1231 -sed -i 's/#if __has_include()/#if __has_include()/g' /usr/lib/folly/folly/detail/Demangle.h - -rm -rf lib -mkdir lib -pushd lib -ln -s /usr/lib/folly -ln -s /usr/lib/glog -ln -s /usr/lib/double-conversion -popd # lib - -rm -rf _generated -mkdir _generated +sed -i 's/#if __has_include()/#if __has_include()/g' /usr/local/include/folly/detail/Demangle.h rm -rf cmake/build mkdir -p cmake/build -scripts/proto_codegen.sh scripts/build_sources.sh diff --git a/services/tunnelbroker/CMakeLists.txt b/services/tunnelbroker/CMakeLists.txt --- a/services/tunnelbroker/CMakeLists.txt +++ b/services/tunnelbroker/CMakeLists.txt @@ -12,9 +12,10 @@ find_package(PkgConfig REQUIRED) -# FIND LIBS -include(./cmake-components/grpc.cmake) -include(./cmake-components/folly.cmake) +find_package(double-conversion REQUIRED) +find_package(Folly REQUIRED) +find_package(protobuf REQUIRED) +find_package(gRPC REQUIRED) # Find AMQP-CPP installation find_package(amqpcpp CONFIG REQUIRED) @@ -25,6 +26,20 @@ # Find Libuv installation pkg_check_modules(LIBUV REQUIRED libuv>=1.43) +if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL "/transferred") + # Inside the docker build contex + set(proto-path "grpc") +else() + # Inside repo + set(proto-path "../../native/cpp/") +endif() + +# Shared Comm protos +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${proto-path} + ${CMAKE_CURRENT_BINARY_DIR}/protos + EXCLUDE_FROM_ALL +) + set(BUILD_TESTING OFF CACHE BOOL "Turn off tests" FORCE) set(WITH_GFLAGS OFF CACHE BOOL "Turn off gflags" FORCE) @@ -38,7 +53,7 @@ set(RUST_HEADERS_INCLUDE_DIR "rust-notifications/extern") set(RUST_LIBS "rust-notifications") -add_subdirectory(./lib/glog) +find_package(glog) # Generated sources get_filename_component(proto "protos/tunnelbroker.proto" ABSOLUTE) @@ -78,8 +93,6 @@ ./src/Tools ./src/Amqp ${GENERATED_BASE_DIR} - ${FOLLY_INCLUDES} - ./lib/double-conversion ${Boost_INCLUDE_DIR} ${CRYPTOPP_INCLUDE_DIRS} ${LIBUV_INCLUDE_DIRS} @@ -97,9 +110,8 @@ set( LIBS - ${GRPC_LIBS} - ${_PROTOBUF_LIBPROTOBUF} - ${_REFLECTION} + gRPC::grpc++_reflection + gRPC::grpc++ ${AWSSDK_LINK_LIBRARIES} ${CRYPTOPP_LIBRARIES} ${LIBUV_LIBRARIES} @@ -108,6 +120,8 @@ amqpcpp OpenSSL::SSL glog::glog + double-conversion::double-conversion + Folly::folly ) # SERVER diff --git a/services/tunnelbroker/Dockerfile b/services/tunnelbroker/Dockerfile --- a/services/tunnelbroker/Dockerfile +++ b/services/tunnelbroker/Dockerfile @@ -1,4 +1,4 @@ -FROM commapp/services-base:1.2 +FROM commapp/services-base:latest ARG MAKE_JOBS=4 ENV MAKEFLAGS="-j${MAKE_JOBS}" @@ -31,7 +31,7 @@ WORKDIR /transferred -COPY native/cpp/CommonCpp/grpc/protos/tunnelbroker.proto protos/tunnelbroker.proto +ADD native/cpp/CommonCpp/grpc grpc COPY services/lib/cmake-components cmake-components COPY services/lib/docker/ scripts/ COPY services/tunnelbroker/docker/* docker/