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

96 lines
3.2 KiB
Docker

# Login-Server Build dependencies for alpine
# Uploaded to hub.docker.com with the tag:
# gradido/login_dependencies:alpine-debug-3 for debug build
# and
# gradido/login_dependencies:alpine-release-3 for release 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 alpine:3.13.5 as alpine-build
RUN apk add --update --no-cache icu-dev
RUN apk add --no-cache git openssl-dev make gcc musl-dev g++ linux-headers libintl gettext-dev boost-dev libsodium-dev
##### CMAKE #####
FROM alpine-build as alpine-gxx-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 alpine-gxx-cmake as alpine-gxx-protobuf
ARG BUILD_TYPE=Debug
RUN apk add --no-cache autoconf automake libtool curl unzip
RUN git clone https://github.com/protocolbuffers/protobuf.git --recursive -j4 && \
cd protobuf && \
./autogen.sh && \
./configure && \
make -j$(nproc) && \
make install
# protobuf libs missing after make install
#RUN cp grpc/build/third_party/protobuf/*.a /usr/local/lib/
######### BUILD poco ##############
FROM alpine-gxx-cmake as alpine-gxx-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 alpine-gxx-cmake as alpine-gxx-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 alpine-build as alpine-libs
# copy CMake from cmake stage
COPY --from=alpine-gxx-cmake /usr/local/bin/cmake /usr/local/bin/cmake
COPY --from=alpine-gxx-cmake /usr/local/share/cmake-3.19/Modules /usr/local/share/cmake-3.19/Modules
COPY --from=alpine-gxx-cmake /usr/local/share/cmake-3.19/Templates /usr/local/share/cmake-3.19/Templates
# copy from grpc
COPY --from=alpine-gxx-protobuf /usr/local /usr/local
# COPY from poco
COPY --from=alpine-gxx-poco /usr/local /usr/local
# COPY from mariadb
COPY --from=alpine-gxx-mariadb-connector /usr/local /usr/local
#########################################################################################################
# COPY Things only needed for testing
#########################################################################################################
FROM alpine-libs as alpine-libs-test
COPY --from=alpine-gxx-protobuf /protobuf/third_party/googletest /usr/local/googletest