You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tubemq.apache.org by go...@apache.org on 2020/10/30 06:05:42 UTC

[incubator-tubemq] branch master updated: [TUBEMQ-390] support build C++ SDK with docker image (#293)

This is an automated email from the ASF dual-hosted git repository.

gosonzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tubemq.git


The following commit(s) were added to refs/heads/master by this push:
     new 888226c  [TUBEMQ-390] support build C++ SDK with docker image (#293)
888226c is described below

commit 888226c04346f4d73cd6bb011a912a2968dce64e
Author: dockerzhang <zh...@outlook.com>
AuthorDate: Fri Oct 30 14:05:28 2020 +0800

    [TUBEMQ-390] support build C++ SDK with docker image (#293)
    
    Co-authored-by: dockerzhang <do...@tencent.com>
---
 tubemq-client-twins/tubemq-client-cpp/README.md |  3 +-
 tubemq-docker/tubemq-cpp/Dockerfile             | 32 +++++++++++
 tubemq-docker/tubemq-cpp/README.md              | 13 +++++
 tubemq-docker/tubemq-cpp/pom.xml                | 72 +++++++++++++++++++++++++
 4 files changed, 119 insertions(+), 1 deletion(-)

diff --git a/tubemq-client-twins/tubemq-client-cpp/README.md b/tubemq-client-twins/tubemq-client-cpp/README.md
index fe41050..6ff4751 100644
--- a/tubemq-client-twins/tubemq-client-cpp/README.md
+++ b/tubemq-client-twins/tubemq-client-cpp/README.md
@@ -37,4 +37,5 @@
   * chmod +x release_linux.sh
   * ./release_linux.sh
 
-
+## (Optional) build using docker
+  * [build c++ sdk](https://github.com/apache/incubator-tubemq/tree/master/tubemq-docker/tubemq-cpp)
\ No newline at end of file
diff --git a/tubemq-docker/tubemq-cpp/Dockerfile b/tubemq-docker/tubemq-cpp/Dockerfile
new file mode 100644
index 0000000..66fc1fc
--- /dev/null
+++ b/tubemq-docker/tubemq-cpp/Dockerfile
@@ -0,0 +1,32 @@
+#
+# 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 rikorose/gcc-cmake:gcc-4
+RUN apt-get remove openssl -y
+RUN wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz \
+    && tar -xzvf openssl-1.1.0f.tar.gz \
+    && rm openssl-1.1.0f.tar.gz && cd openssl-1.1.0f \
+    && ./config && make && make install
+RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v3.13.0/protobuf-cpp-3.13.0.tar.gz \
+    && tar -xzvf protobuf-cpp-3.13.0.tar.gz && rm protobuf-cpp-3.13.0.tar.gz \
+    && cd protobuf-3.13.0 && ./autogen.sh \
+    && ./configure CXXFLAGS=-fPIC && make \
+    && make install && cd /usr/local/lib \
+    && ln -snf libprotobuf.so libprotobuf.so.24
+ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64/
+WORKDIR /tubemq-cpp/
\ No newline at end of file
diff --git a/tubemq-docker/tubemq-cpp/README.md b/tubemq-docker/tubemq-cpp/README.md
new file mode 100644
index 0000000..584c945
--- /dev/null
+++ b/tubemq-docker/tubemq-cpp/README.md
@@ -0,0 +1,13 @@
+### Docker image for building TubeMQ C++ SDK Client
+##### Pull Image
+```
+docker pull apachetubemq/tubemq-cpp
+```
+
+#### Build TubeMQ C++ SDK Client
+```
+docker run -it --net=host -v REPLACE_BY_CPP_SOURCE_DIR_PATH:/tubemq-cpp/  apachetubemq/tubemq-cpp /bin/bash
+sh build_linux.sh
+cd release/
+sh release_linux.sh
+```
\ No newline at end of file
diff --git a/tubemq-docker/tubemq-cpp/pom.xml b/tubemq-docker/tubemq-cpp/pom.xml
new file mode 100644
index 0000000..d1c9cc4
--- /dev/null
+++ b/tubemq-docker/tubemq-cpp/pom.xml
@@ -0,0 +1,72 @@
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <parent>
+    <artifactId>tubemq-docker</artifactId>
+    <groupId>org.apache.tubemq</groupId>
+    <version>0.6.0-incubating</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <name>Apache TubeMQ - Docker Build C++ SDK Client</name>
+  <groupId>org.apache.tubemq</groupId>
+  <artifactId>tubemq-cpp</artifactId>
+  <packaging>pom</packaging>
+
+  <profiles>
+    <profile>
+      <id>docker</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>com.spotify</groupId>
+            <artifactId>dockerfile-maven-plugin</artifactId>
+            <version>${dockerfile-maven.version}</version>
+            <executions>
+              <execution>
+                <id>default</id>
+                <goals>
+                  <goal>build</goal>
+                </goals>
+              </execution>
+              <execution>
+                <id>tag-and-push-latest</id>
+                <goals>
+                  <goal>tag</goal>
+                  <goal>push</goal>
+                </goals>
+                <configuration>
+                  <repository>${docker.organization}/tubemq-cpp</repository>
+                  <tag>latest</tag>
+                </configuration>
+              </execution>
+            </executions>
+            <configuration>
+              <repository>${docker.organization}/tubemq-cpp</repository>
+              <pullNewerImage>false</pullNewerImage>
+              <tag>${project.version}</tag>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>