1+ #
2+ # Licensed to the Apache Software Foundation (ASF) under one
3+ # or more contributor license agreements. See the NOTICE file
4+ # distributed with this work for additional information
5+ # regarding copyright ownership. The ASF licenses this file
6+ # to you under the Apache License, Version 2.0 (the
7+ # "License"); you may not use this file except in compliance
8+ # with the License. You may obtain a copy of the License at
9+ #
10+ # http://www.apache.org/licenses/LICENSE-2.0
11+ #
12+ # Unless required by applicable law or agreed to in writing,
13+ # software distributed under the License is distributed on an
14+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+ # KIND, either express or implied. See the License for the
16+ # specific language governing permissions and limitations
17+ # under the License.
18+ #
19+
20+ # Use CentOS 7 as base image
21+ FROM centos:7
22+
23+ # Set working directory
24+ WORKDIR /dataproxy-sdk-cpp/
25+
26+ # # Switch to Tencent mirror to fix CentOS 7 yum source issues
27+ RUN sed -e 's|^mirrorlist=|#mirrorlist=|g' \
28+ -e 's|^#baseurl=http://mirror.centos.org|baseurl=https://mirrors.tencent.com|g' \
29+ -i.bak /etc/yum.repos.d/CentOS-*.repo && \
30+ yum clean all && \
31+ yum makecache
32+
33+ # Install necessary dependency packages
34+ RUN yum update -y && \
35+ yum install -y \
36+ gcc \
37+ gcc-c++ \
38+ make \
39+ autoconf \
40+ automake \
41+ libtool \
42+ pkgconfig \
43+ wget \
44+ openssl-devel \
45+ zlib-devel \
46+ && yum clean all && rm -rf /var/cache/yum
47+
48+ # Build and install SSL-enabled curl (used by Git and CMake)
49+ ARG CURL_VERSION=7.78.0
50+ RUN cd /tmp && \
51+ wget https://curl.se/download/curl-${CURL_VERSION}.tar.gz && \
52+ tar -xzf curl-${CURL_VERSION}.tar.gz && \
53+ cd curl-${CURL_VERSION} && \
54+ ./configure --prefix=/usr/local --with-ssl --with-zlib && \
55+ make -j"$(nproc)" && \
56+ make install && \
57+ ln -sf /usr/local/bin/curl /usr/bin/curl && \
58+ echo "/usr/local/lib" > /etc/ld.so.conf.d/usr-local.conf && ldconfig && \
59+ cd / && rm -rf /tmp/curl-*
60+
61+ # Verify curl SSL support
62+ RUN curl --version
63+
64+ # Build and install Git (compile from source with CURL support)
65+ ARG GIT_VERSION=2.34.1
66+ RUN cd /tmp && \
67+ wget https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz && \
68+ tar -xzf v${GIT_VERSION}.tar.gz && \
69+ cd git-${GIT_VERSION} && \
70+ make configure && \
71+ ./configure --prefix=/usr/local --with-curl=/usr/local && \
72+ make -j"$(nproc)" \
73+ NO_GETTEXT=YesPlease \
74+ NO_EXPAT=YesPlease \
75+ NO_PERL=YesPlease \
76+ NO_TCLTK=YesPlease && \
77+ make install \
78+ NO_GETTEXT=YesPlease \
79+ NO_EXPAT=YesPlease \
80+ NO_PERL=YesPlease \
81+ NO_TCLTK=YesPlease && \
82+ ln -sf /usr/local/bin/git /usr/bin/git && \
83+ cd / && rm -rf /tmp/git-* /tmp/v${GIT_VERSION}.tar.gz
84+
85+ # Verify gcc and git versions
86+ RUN gcc --version && git --version
87+
88+ # Build and install CMake using system curl
89+ ARG CMAKE_VERSION=3.12.4
90+ RUN cd /tmp && \
91+ wget https://cmake.org/files/v3.12/cmake-${CMAKE_VERSION}.tar.gz && \
92+ tar -xzf cmake-${CMAKE_VERSION}.tar.gz && \
93+ cd cmake-${CMAKE_VERSION} && \
94+ ./configure --prefix=/usr/local --system-curl && \
95+ make -j"$(nproc)" && \
96+ make install && \
97+ ln -sf /usr/local/bin/cmake /usr/bin/cmake && \
98+ ln -sf /usr/local/bin/ctest /usr/bin/ctest && \
99+ ln -sf /usr/local/bin/cpack /usr/bin/cpack && \
100+ cd / && rm -rf /tmp/cmake-*
101+
102+ # Verify CMake version
103+ RUN cmake --version
104+
105+ # Copy and setup build script from docker directory
106+ COPY build_docker.sh /usr/local/bin/build_docker.sh
107+ RUN chmod +x /usr/local/bin/build_docker.sh
108+
109+ # Set entrypoint to build script
110+ ENTRYPOINT ["/usr/local/bin/build_docker.sh" ]
0 commit comments