diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/README.md b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/README.md index 0cc36398c2a..3fe02b53c94 100644 --- a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/README.md +++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/README.md @@ -47,35 +47,9 @@ Go to the `dataproxy-sdk-cpp` directory, and run: ### Method 2: Docker Build -**Prerequisites for Docker build:** -- Docker installed on your system +Use a pre-configured Docker environment with all necessary dependencies. -This method uses a pre-configured Docker environment with all necessary dependencies. - -Go to the `dataproxy-sdk-cpp` directory, and run: - -1. Build the Docker image: -```bash -docker build -f docker/Dockerfile -t inlong/dataproxy-cpp-compile . -``` - -2. Run the build: -```bash -docker run -v $(pwd):/dataproxy-sdk-cpp inlong/dataproxy-cpp-compile -``` - -Alternatively, you can navigate to the docker directory and build from there: - -```bash -cd docker -docker build -t inlong/dataproxy-cpp-compile . -cd .. -docker run -v $(pwd):/dataproxy-sdk-cpp inlong/dataproxy-cpp-compile -``` - -Build artifacts will be available in the `build/` and `release/` subdirectories. - -For more details about Docker build, see [docker/README-Docker.md](docker/README-Docker.md). +For detailed instructions on Docker-based builds, see [dataproxy-sdk-docker/README.md](../dataproxy-sdk-docker/README.md). ## Config Parameters diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/docker/Dockerfile b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/docker/Dockerfile deleted file mode 100644 index db2f8106175..00000000000 --- a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/docker/Dockerfile +++ /dev/null @@ -1,110 +0,0 @@ -# -# 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. -# - -# Use CentOS 7 as base image -FROM centos:7 - -# Set working directory -WORKDIR /dataproxy-sdk-cpp/ - -## Switch to Tencent mirror to fix CentOS 7 yum source issues -RUN sed -e 's|^mirrorlist=|#mirrorlist=|g' \ - -e 's|^#baseurl=http://mirror.centos.org|baseurl=https://mirrors.tencent.com|g' \ - -i.bak /etc/yum.repos.d/CentOS-*.repo && \ - yum clean all && \ - yum makecache - -# Install necessary dependency packages -RUN yum update -y && \ - yum install -y \ - gcc \ - gcc-c++ \ - make \ - autoconf \ - automake \ - libtool \ - pkgconfig \ - wget \ - openssl-devel \ - zlib-devel \ - && yum clean all && rm -rf /var/cache/yum - -# Build and install SSL-enabled curl (used by Git and CMake) -ARG CURL_VERSION=7.78.0 -RUN cd /tmp && \ - wget https://curl.se/download/curl-${CURL_VERSION}.tar.gz && \ - tar -xzf curl-${CURL_VERSION}.tar.gz && \ - cd curl-${CURL_VERSION} && \ - ./configure --prefix=/usr/local --with-ssl --with-zlib && \ - make -j"$(nproc)" && \ - make install && \ - ln -sf /usr/local/bin/curl /usr/bin/curl && \ - echo "/usr/local/lib" > /etc/ld.so.conf.d/usr-local.conf && ldconfig && \ - cd / && rm -rf /tmp/curl-* - -# Verify curl SSL support -RUN curl --version - -# Build and install Git (compile from source with CURL support) -ARG GIT_VERSION=2.34.1 -RUN cd /tmp && \ - wget https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz && \ - tar -xzf v${GIT_VERSION}.tar.gz && \ - cd git-${GIT_VERSION} && \ - make configure && \ - ./configure --prefix=/usr/local --with-curl=/usr/local && \ - make -j"$(nproc)" \ - NO_GETTEXT=YesPlease \ - NO_EXPAT=YesPlease \ - NO_PERL=YesPlease \ - NO_TCLTK=YesPlease && \ - make install \ - NO_GETTEXT=YesPlease \ - NO_EXPAT=YesPlease \ - NO_PERL=YesPlease \ - NO_TCLTK=YesPlease && \ - ln -sf /usr/local/bin/git /usr/bin/git && \ - cd / && rm -rf /tmp/git-* /tmp/v${GIT_VERSION}.tar.gz - -# Verify gcc and git versions -RUN gcc --version && git --version - -# Build and install CMake using system curl -ARG CMAKE_VERSION=3.12.4 -RUN cd /tmp && \ - wget https://cmake.org/files/v3.12/cmake-${CMAKE_VERSION}.tar.gz && \ - tar -xzf cmake-${CMAKE_VERSION}.tar.gz && \ - cd cmake-${CMAKE_VERSION} && \ - ./configure --prefix=/usr/local --system-curl && \ - make -j"$(nproc)" && \ - make install && \ - ln -sf /usr/local/bin/cmake /usr/bin/cmake && \ - ln -sf /usr/local/bin/ctest /usr/bin/ctest && \ - ln -sf /usr/local/bin/cpack /usr/bin/cpack && \ - cd / && rm -rf /tmp/cmake-* - -# Verify CMake version -RUN cmake --version - -# Copy and setup build script from docker directory -COPY build_docker.sh /usr/local/bin/build_docker.sh -RUN chmod +x /usr/local/bin/build_docker.sh - -# Set entrypoint to build script -ENTRYPOINT ["/usr/local/bin/build_docker.sh"] \ No newline at end of file diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/docker/README-Docker.md b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/docker/README-Docker.md deleted file mode 100644 index ee5a1a8a80f..00000000000 --- a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/docker/README-Docker.md +++ /dev/null @@ -1,55 +0,0 @@ -# DataProxy SDK C++ Docker Compile Environment - -Docker image providing GCC, CMake, and Git environment for compiling C++ dataproxy SDK. - -## Environment - -- **OS**: CentOS 7 -- **GCC**: System default (4.8.5) -- **CMake**: 3.12.4 -- **Git**: 2.34.1 -- **Curl**: 7.78.0 -- **Tools**: gcc, gcc-c++, make, autoconf, automake, libtool, pkgconfig, openssl-devel, zlib-devel - -## Build Docker Image - -Navigate to the `dataproxy-sdk-cpp/docker` directory and build the image: - -```bash -cd docker -docker build -t inlong/dataproxy-cpp-compile . -``` - -## Usage - -### Basic Usage - -Run from the `dataproxy-sdk-cpp` directory: - -```bash -docker run -v $(pwd):/dataproxy-sdk-cpp inlong/dataproxy-cpp-compile -``` - -### Example - -```bash -# Navigate to the dataproxy-sdk-cpp directory -cd /path/to/inlong/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp - -# Run the build -docker run -v $(pwd):/dataproxy-sdk-cpp inlong/dataproxy-cpp-compile -``` - -### Alternative Usage - -You can also run from any directory by specifying the full path: - -```bash -docker run -v /path/to/dataproxy-sdk-cpp:/dataproxy-sdk-cpp inlong/dataproxy-cpp-compile -``` - -## Output - -Build artifacts will be available in the following directories of your source code: -- `build/` - CMake build directory with object files and intermediate artifacts -- `release/` - Final release artifacts and libraries \ No newline at end of file diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-docker/Dockerfile b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-docker/Dockerfile new file mode 100644 index 00000000000..638e3a7170a --- /dev/null +++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-docker/Dockerfile @@ -0,0 +1,152 @@ +# +# 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. +# + +FROM centos:7 + +ARG PYTHON_VERSION=3.8.0 +ARG CMAKE_VERSION=3.12.4 +ARG CURL_VERSION=7.78.0 +ARG OPENSSL_VERSION=1.1.1w +ARG GIT_VERSION=2.34.1 + +WORKDIR /workspace + +RUN sed -e 's|^mirrorlist=|#mirrorlist=|g' \ + -e 's|^#baseurl=http://mirror.centos.org|baseurl=https://mirrors.tencent.com|g' \ + -i.bak /etc/yum.repos.d/CentOS-*.repo && \ + yum clean all && \ + yum makecache && \ + yum update -y && \ + yum install -y \ + gcc \ + gcc-c++ \ + make \ + autoconf \ + automake \ + libtool \ + pkgconfig \ + wget \ + openssl-devel \ + zlib-devel \ + glibc-devel \ + glibc-headers \ + kernel-headers \ + libffi-devel \ + curl-devel \ + expat-devel \ + gettext-devel \ + perl-CPAN \ + perl-devel \ + && \ + yum clean all && \ + rm -rf /var/cache/yum + +# Build and install Git, Curl and CMake +RUN cd /tmp && \ + # Build Git \ + wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.gz && \ + tar -xzf git-${GIT_VERSION}.tar.gz && \ + cd git-${GIT_VERSION} && \ + make prefix=/usr/local all -j"$(nproc)" && \ + make prefix=/usr/local install && \ + cd /tmp && \ + rm -rf git-* && \ + # Build Curl \ + wget https://curl.se/download/curl-${CURL_VERSION}.tar.gz && \ + tar -xzf curl-${CURL_VERSION}.tar.gz && \ + cd curl-${CURL_VERSION} && \ + ./configure \ + --prefix=/usr/local \ + --with-ssl \ + --with-zlib \ + && \ + make -j"$(nproc)" && \ + make install && \ + ln -sf /usr/local/bin/curl /usr/bin/curl && \ + echo "/usr/local/lib" > /etc/ld.so.conf.d/usr-local.conf && \ + ldconfig && \ + cd /tmp && \ + rm -rf curl-* && \ + # Install CMake \ + wget https://cmake.org/files/v3.12/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz && \ + tar -xzf cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz -C /usr/local --strip-components=1 && \ + cd / && \ + rm -rf /tmp/* + +# Build and install OpenSSL +RUN cd /tmp && \ + wget https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz && \ + tar -xzf openssl-${OPENSSL_VERSION}.tar.gz && \ + cd openssl-${OPENSSL_VERSION} && \ + ./config \ + --prefix=/usr/local/openssl \ + --openssldir=/usr/local/openssl \ + shared \ + zlib \ + enable-ec_nistp_64_gcc_128 \ + -Wl,-rpath=/usr/local/openssl/lib \ + && \ + make -j$(nproc) && \ + make install && \ + echo "/usr/local/openssl/lib" > /etc/ld.so.conf.d/openssl-1.1.1.conf && \ + ldconfig && \ + cd / && \ + rm -rf /tmp/* + +# Set OpenSSL environment variables +ENV LDFLAGS="-L/usr/local/openssl/lib -Wl,-rpath,/usr/local/openssl/lib" \ + CPPFLAGS="-I/usr/local/openssl/include" \ + PKG_CONFIG_PATH="/usr/local/openssl/lib/pkgconfig:${PKG_CONFIG_PATH}" \ + PATH="/usr/local/bin:${PATH}" + +# Build and install Python +RUN cd /tmp && \ + wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz && \ + tar -xzf Python-${PYTHON_VERSION}.tgz && \ + cd Python-${PYTHON_VERSION} && \ + ./configure \ + --prefix=/usr/local \ + --enable-shared \ + --with-openssl=/usr/local/openssl \ + --with-openssl-rpath=auto \ + --with-ssl-default-suites=openssl \ + --with-system-ffi \ + --with-computed-gotos \ + --enable-loadable-sqlite-extensions \ + && \ + make -j"$(nproc)" && \ + make altinstall && \ + PYTHON_MAJOR_MINOR=$(echo ${PYTHON_VERSION} | cut -d. -f1,2) && \ + ln -sf /usr/local/bin/python${PYTHON_MAJOR_MINOR} /usr/local/bin/python && \ + ln -sf /usr/local/bin/python${PYTHON_MAJOR_MINOR} /usr/local/bin/python3 && \ + ln -sf /usr/local/bin/pip${PYTHON_MAJOR_MINOR} /usr/local/bin/pip && \ + ln -sf /usr/local/bin/pip${PYTHON_MAJOR_MINOR} /usr/local/bin/pip3 && \ + echo "/usr/local/lib" >> /etc/ld.so.conf.d/usr-local.conf && \ + ldconfig && \ + cd / && \ + rm -rf /tmp/* + +# Verify installations and create environment info +RUN gcc --version && \ + cmake --version && \ + git --version && \ + python --version && \ + pip --version + +CMD ["/bin/bash"] \ No newline at end of file diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-docker/README.md b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-docker/README.md new file mode 100644 index 00000000000..b7569c405d0 --- /dev/null +++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-docker/README.md @@ -0,0 +1,64 @@ +## Docker Image for Building DataProxy SDK + +This image provides a complete build environment for compiling InLong DataProxy C++ and Python SDKs. + +### Requirements + +- [Docker](https://docs.docker.com/engine/install/) 19.03.1+ + +### Pull Image + +```bash +docker pull inlong/dataproxy-sdk-build:latest +``` + +### Build SDKs + +This image supports building both InLong Dataproxy C++ and Python SDKs. Python SDK is a wrapper over the C++ SDK and requires C++ SDK to be built first. + +#### Option 1: Interactive Build + +```bash +# Run container +docker run -it inlong/dataproxy-sdk-build:latest + +# Inside container: clone and build C++ SDK +git clone https://github.com/apache/inlong.git +cd inlong/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp +./build_third_party.sh && ./build.sh + +# [Optional] Build Python SDK (requires C++ SDK built first) +cd ../dataproxy-sdk-python +./build.sh +# Verify: python -c "import inlong_dataproxy" +``` + +#### Option 2: Mount Source Code + +```bash +# Mount your local InLong source code +docker run -it -v /path/to/inlong:/workspace/inlong inlong/dataproxy-sdk-build:latest bash + +# Inside container: build C++ SDK +cd /workspace/inlong/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp +./build_third_party.sh && ./build.sh + +# [Optional] Build Python SDK +cd ../dataproxy-sdk-python +./build.sh +``` + +### Build Your Own Image + +#### Basic Build + +```bash +cd inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-docker +docker build -t inlong/dataproxy-sdk-build:latest . +``` + +#### Custom Python Version + +```bash +docker build --build-arg PYTHON_VERSION=3.9.18 -t inlong/dataproxy-sdk-build:py39 . +```