forked from googleapis/google-cloud-cpp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
demo-ubuntu-bionic.Dockerfile
169 lines (144 loc) · 5.66 KB
/
demo-ubuntu-bionic.Dockerfile
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# Copyright 2021 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
#
# https://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 ubuntu:bionic
ARG NCPU=4
## [BEGIN packaging.md]
# Install the minimal development tools, libcurl, OpenSSL and libc-ares:
# ```bash
RUN apt-get update && \
apt-get --no-install-recommends install -y apt-transport-https apt-utils \
automake build-essential ccache cmake ca-certificates curl git \
gcc g++ libc-ares-dev libc-ares2 libcurl4-openssl-dev libssl-dev m4 \
make pkg-config tar wget zlib1g-dev
# ```
# #### Abseil
# We need a recent version of Abseil.
# :warning: By default, Abseil's ABI changes depending on whether it is used
# with C++ >= 17 enabled or not. Installing Abseil with the default
# configuration is error-prone, unless you can guarantee that all the code using
# Abseil (gRPC, google-cloud-cpp, your own code, etc.) is compiled with the same
# C++ version. We recommend that you switch the default configuration to pin
# Abseil's ABI to the version used at compile time. In this case, the compiler
# defaults to C++14. Therefore, we change `absl/base/options.h` to **always**
# use `absl::any`, `absl::string_view`, and `absl::variant`. See
# [abseil/abseil-cpp#696] for more information.
# ```bash
WORKDIR /var/tmp/build/abseil-cpp
RUN curl -sSL https://github.com/abseil/abseil-cpp/archive/20230125.3.tar.gz | \
tar -xzf - --strip-components=1 && \
sed -i 's/^#define ABSL_OPTION_USE_\(.*\) 2/#define ABSL_OPTION_USE_\1 0/' "absl/base/options.h" && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DABSL_BUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=yes \
-H. -Bcmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
ldconfig
# ```
# #### Protobuf
# We need to install a version of Protobuf that is recent enough to support the
# Google Cloud Platform proto files:
# ```bash
WORKDIR /var/tmp/build/protobuf
RUN curl -sSL https://github.com/protocolbuffers/protobuf/archive/v22.4.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_ABSL_PROVIDER=package \
-H. -Bcmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
ldconfig
# ```
# #### RE2
# We need a newer version of RE2 than the system package provides.
# ```bash
WORKDIR /var/tmp/build/re2
RUN curl -sSL https://github.com/google/re2/archive/2023-03-01.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake -DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DRE2_BUILD_TESTING=OFF \
-H. -Bcmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
ldconfig
# ```
# #### gRPC
# We also need a version of gRPC that is recent enough to support the Google
# Cloud Platform proto files. We install it using:
# ```bash
WORKDIR /var/tmp/build/grpc
RUN curl -sSL https://github.com/grpc/grpc/archive/v1.55.0-pre1.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DgRPC_ABSL_PROVIDER=package \
-DgRPC_CARES_PROVIDER=package \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_PROTOBUF_PACKAGE_TYPE=CONFIG \
-DgRPC_RE2_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package \
-H. -Bcmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
ldconfig
# ```
# #### crc32c
# The project depends on the Crc32c library, we need to compile this from
# source:
# ```bash
WORKDIR /var/tmp/build/crc32c
RUN curl -sSL https://github.com/google/crc32c/archive/1.1.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DCRC32C_BUILD_TESTS=OFF \
-DCRC32C_BUILD_BENCHMARKS=OFF \
-DCRC32C_USE_GLOG=OFF \
-H. -Bcmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
ldconfig
# ```
# #### nlohmann_json library
# The project depends on the nlohmann_json library. We use CMake to
# install it as this installs the necessary CMake configuration files.
# Note that this is a header-only library, and often installed manually.
# This leaves your environment without support for CMake pkg-config.
# ```bash
WORKDIR /var/tmp/build/json
RUN curl -sSL https://github.com/nlohmann/json/archive/v3.11.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DBUILD_TESTING=OFF \
-DJSON_BuildTests=OFF \
-H. -Bcmake-out && \
cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
ldconfig
# ```
## [DONE packaging.md]
# Some of the above libraries may have installed in /usr/local, so make sure
# those library directories will be found.
RUN ldconfig /usr/local/lib*