-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathDockerfile.alpine
121 lines (111 loc) · 4.43 KB
/
Dockerfile.alpine
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# Copyright 2018 Google LLC
#
# Licensed 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.
#
# Base image
#
FROM alpine:3.11
#
# Dependencies
#
# Everything we can get through apt-get
RUN apk --no-cache add \
autoconf \
automake \
cmake \
curl \
g++ \
git \
libexecinfo-dev \
libexecinfo-static \
libtool \
linux-headers \
make \
nghttp2-static \
unzip \
zlib-dev
# Install JDK 11 as sampling heap profiler depends on the new JVMTI APIs.
RUN apk --no-cache add openjdk11-jdk
# openssl
# This openssl (compiled with -fPIC) is used to statically link into the agent
# shared library.
ENV JAVA_PATH=/usr/lib/jvm/java-11-openjdk/
RUN mkdir /tmp/openssl && cd /tmp/openssl && \
curl -sL https://github.com/openssl/openssl/archive/OpenSSL_1_1_1t.tar.gz | \
tar xzv --strip=1 && \
./config no-shared -fPIC --openssldir=/usr/local/ssl --prefix=/usr/local/ssl && \
make && make install_sw && \
cd ~ && rm -rf /tmp/openssl
# curl
RUN git clone --depth=1 -b curl-8_10_1 https://github.com/curl/curl.git /tmp/curl && \
cd /tmp/curl && \
./buildconf && \
./configure --disable-ldap --disable-shared --without-libssh2 \
--without-librtmp --without-libidn --enable-static \
--without-libidn2 --without-libpsl \
--with-pic --with-ssl=/usr/local/ssl/ && \
make -j && make install && \
cd ~ && rm -rf /tmp/curl
# gflags
RUN git clone --depth=1 -b v2.1.2 https://github.com/gflags/gflags.git /tmp/gflags && \
cd /tmp/gflags && \
mkdir build && cd build && \
cmake -DCMAKE_CXX_FLAGS=-fpic -DGFLAGS_NAMESPACE=google .. && \
make -j && make install && \
cd ~ && rm -rf /tmp/gflags
# google-glog
RUN mkdir /tmp/glog && cd /tmp/glog && \
curl -sL https://github.com/google/glog/archive/v0.4.0.tar.gz | \
tar xzv --strip=1 && ./autogen.sh && \
LDFLAGS="-lexecinfo" ./configure --with-pic --enable-static && \
make -j && make install && \
cd ~ && rm -rf /tmp/glog
# gRPC & protobuf - build using CMake
# Use the protobuf version from gRPC for everything to avoid conflicting
# versions to be linked in. Disable OpenSSL embedding: when it's on, the build
# process of gRPC puts the OpenSSL static object files into the gRPC archive
# which causes link errors later when the agent is linked with the static
# OpenSSL library itself.
# Limit the number of threads used by make, as unlimited threads causes
# memory exhausted error on the Kokoro VM.
#
# See https://github.com/grpc/grpc/blob/v1.46.7/test/distrib/cpp/run_distrib_test_cmake_pkgconfig.sh
RUN git clone --depth=1 --recursive -b v1.46.7 https://github.com/grpc/grpc.git /tmp/grpc && \
cd /tmp/grpc/ && \
# Install protobuf
mkdir -p third_party/protobuf/cmake/build && \
(cd third_party/protobuf/cmake/build && \
cmake -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE -DCMAKE_BUILD_TYPE=Release .. && \
make -j4 install) && \
# Install gRPC
mkdir -p cmake/build && \
cd cmake/build && \
cmake \
-DOPENSSL_ROOT_DIR=/usr/local/ssl \
-DOPENSSL_INCLUDE_DIR=/usr/local/ssl/include \
-DOPENSSL_CRYPTO_LIB=/usr/local/ssl/lib \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local/grpc \
-DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DgRPC_ABSL_PROVIDER=module \
-DgRPC_CARES_PROVIDER=module \
-DgRPC_RE2_PROVIDER=module \
-DgRPC_ZLIB_PROVIDER=module \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
../.. && \
make -j4 install && \
cd ~ && rm -rf /tmp/grpc
ENV PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/usr/local/ssl/lib/pkgconfig:/usr/local/grpc/lib/pkgconfig:/usr/local/grpc/lib64/pkgconfig:/usr/local/lib64/pkgconfig"
ENV PATH="${PATH}:/usr/local/grpc/bin"