-
Notifications
You must be signed in to change notification settings - Fork 239
/
Copy pathDockerfile.glibc
72 lines (66 loc) · 2.32 KB
/
Dockerfile.glibc
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
# we use centos 7 to build against glibc 2.17
FROM public.ecr.aws/docker/library/centos:7
ARG CURL_VERSION
# Add Corretto repository
RUN rpm --import https://yum.corretto.aws/corretto.key && \
curl -L -o /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo
# aws-lambda-cpp requires cmake3, it's available in EPEL
RUN yum install -y epel-release
RUN yum install -y \
cmake3 \
make \
gcc \
gcc-c++ \
libstdc++-static \
glibc-devel \
gmp-devel \
libmpc-devel \
libtool \
mpfr-devel \
wget \
java-1.8.0-amazon-corretto-devel
# Install curl dependency
COPY ./deps/curl-$CURL_VERSION.tar.gz /src/deps/
RUN tar xzf /src/deps/curl-$CURL_VERSION.tar.gz -C /src/deps && mv /src/deps/curl-$CURL_VERSION /src/deps/curl
WORKDIR /src/deps/curl
RUN ./configure \
--prefix $(pwd)/../artifacts \
--disable-shared \
--without-ssl \
--with-pic \
--without-zlib && \
make && \
make install
# Install aws-lambda-cpp dependency
ADD ./deps/aws-lambda-cpp-* /src/deps/aws-lambda-cpp
RUN sed -i.bak 's/VERSION 3.9/VERSION 3.6/' /src/deps/aws-lambda-cpp/CMakeLists.txt
RUN mkdir -p /src/deps/aws-lambda-cpp/build
WORKDIR /src/deps/aws-lambda-cpp/build
RUN cmake3 .. \
-DENABLE_LTO=OFF \
-DCMAKE_CXX_FLAGS="-fPIC -DBACKWARD_SYSTEM_UNKNOWN" \
-DCMAKE_CXX_STANDARD=11 \
-DCMAKE_INSTALL_PREFIX=$(pwd)/../../artifacts \
-DCMAKE_MODULE_PATH=$(pwd)/../../artifacts/lib/pkgconfig && \
make && \
make install
# Build native client
ADD *.cpp *.h /src/
WORKDIR /src
ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto
RUN /usr/bin/c++ -c \
-std=gnu++11 \
-fPIC \
-I${JAVA_HOME}/include \
-I${JAVA_HOME}/include/linux \
-I ./deps/artifacts/include \
com_amazonaws_services_lambda_runtime_api_client_runtimeapi_NativeClient.cpp -o com_amazonaws_services_lambda_runtime_api_client_runtimeapi_NativeClient.o && \
/usr/bin/c++ -shared \
-std=gnu++11 \
-o aws-lambda-runtime-interface-client.so com_amazonaws_services_lambda_runtime_api_client_runtimeapi_NativeClient.o \
-L ./deps/artifacts/lib64/ \
-L ./deps/artifacts/lib/ \
-laws-lambda-runtime \
-lcurl \
-static-libstdc++ \
-lrt