gradido/login_server/Dockerfiles/Dockerfile.dependencies
2021-05-25 17:46:08 +02:00

86 lines
2.8 KiB
Docker

##### BUILD-ENV #####
FROM gcc:9 as gcc9_build
RUN apt-get update && \
apt-get install -y --no-install-recommends libssl-dev libboost-dev gettext libsodium-dev lcov && \
apt-get autoclean && \
apt-get autoremove && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
#########################################################################################################
# gcc 9 cmake
#########################################################################################################
FROM gcc9_build as gcc_9_cmake
RUN git clone https://github.com/Kitware/CMake.git --branch=v3.19.8 && \
cd CMake && \
./bootstrap --parallel=$(nproc) && \
make -j$(nproc) && \
make install
######### BUILD grpc ##############
FROM gcc_9_cmake as gcc_9_grpc
ARG BUILD_TYPE=Debug
RUN git clone https://github.com/grpc/grpc.git --branch=v1.37.0 --recursive -j4 && \
cd grpc && \
mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. && make -j$(nproc) && \
make install
# abseil don't install themself correctly
RUN cp -r grpc/third_party/abseil-cpp/absl /usr/local/include/
# protobuf libs missing after make install
RUN cp grpc/build/third_party/protobuf/*.a /usr/local/lib/
######### BUILD poco ##############
FROM gcc_9_cmake as gcc_9_poco
ARG BUILD_TYPE=Debug
RUN git clone https://github.com/pocoproject/poco.git --recursive && \
cd poco && \
git checkout poco-1.9.4-release && \
mkdir cmake-build && cd cmake-build && \
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. && make -j$(nproc) && \
make install
######### BUILD mariadb ###########
FROM gcc_9_cmake as gcc_9_mariadb-connector
ARG BUILD_TYPE=Debug
RUN git clone https://github.com/mariadb-corporation/mariadb-connector-c.git && \
cd mariadb-connector-c && \
git checkout 159540f && \
mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. && make -j$(nproc) && \
make install
#########################################################################################################
# builded libs and binaries
#########################################################################################################
FROM gcc9_build as gcc9_libs
RUN echo '/usr/local/lib' >> /etc/ld.so.conf && ldconfig
# copy CMake from cmake stage
COPY --from=gcc_9_cmake /usr/local/bin/cmake /usr/local/bin/cmake
COPY --from=gcc_9_cmake /usr/local/share/cmake-3.19/Modules /usr/local/share/cmake-3.19/Modules
COPY --from=gcc_9_cmake /usr/local/share/cmake-3.19/Templates /usr/local/share/cmake-3.19/Templates
# copy from grpc
COPY --from=gcc_9_grpc /usr/local /usr/local
COPY --from=gcc_9_grpc /grpc/third_party/googletest /usr/local/googletest
# COPY from poco
COPY --from=gcc_9_poco /usr/local /usr/local
# COPY from mariadb
COPY --from=gcc_9_mariadb-connector /usr/local /usr/local