gradido/login_server/Dockerfiles/ubuntu/Dockerfile.dependencies
2021-06-15 12:55:55 +02:00

94 lines
3.0 KiB
Docker

# Login-Server Build dependencies for ubuntu
# Uploaded to hub.docker.com with the tag:
# gradido/login_dependencies:gcc9-debug-3 for debug build
# Update tag when dependencies are added or removed
# Control Build Type with ARG BUILD_TYPE
# Valid values do you find here: https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html
# Default is set to Debug
##### 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_protobuf
ARG BUILD_TYPE=Debug
RUN git clone https://github.com/protocolbuffers/protobuf.git --recursive -j4 && \
cd protobuf && \
./autogen.sh && \
./configure && \
make -j$(nproc) && \
make install && \
ldconfig
# 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_protobuf /usr/local /usr/local
COPY --from=gcc_9_protobuf /protobuf/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