mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
update dependencie docker to allow different build types
This commit is contained in:
parent
68f3c3736d
commit
d1da7b72b2
@ -9,79 +9,65 @@ RUN apk add --no-cache git openssl-dev make gcc musl-dev g++ linux-headers libin
|
||||
##### CMAKE #####
|
||||
FROM alpine-build as alpine-gxx-cmake
|
||||
|
||||
USER root
|
||||
ENV DOCKER_WORKDIR="/code"
|
||||
|
||||
RUN mkdir -p ${DOCKER_WORKDIR}
|
||||
WORKDIR ${DOCKER_WORKDIR}
|
||||
|
||||
RUN git clone https://github.com/Kitware/CMake.git --branch=v3.19.8 && \
|
||||
cd CMake && \
|
||||
./bootstrap --parallel=$(nproc) && \
|
||||
make -j$(nproc) && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf CMake
|
||||
make install
|
||||
|
||||
RUN ls -la /usr/include/boost
|
||||
######### BUILD grpc ##############
|
||||
FROM alpine-gxx-cmake as alpine-gxx-grpc
|
||||
|
||||
##### BUILD ENV ##############
|
||||
FROM alpine-build as build_debug_dependencies
|
||||
ARG BUILD_TYPE=Debug
|
||||
|
||||
USER root
|
||||
ENV DOCKER_WORKDIR="/code"
|
||||
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
|
||||
|
||||
RUN mkdir -p ${DOCKER_WORKDIR}
|
||||
WORKDIR ${DOCKER_WORKDIR}
|
||||
######### BUILD poco ##############
|
||||
FROM alpine-gxx-cmake as alpine-gxx-poco
|
||||
|
||||
RUN apk add --no-cache git make gettext openssl-dev
|
||||
# copy CMake from last 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
|
||||
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
|
||||
|
||||
# COPY files from context
|
||||
COPY ./dependencies ./dependencies
|
||||
COPY ./scripts ./scripts
|
||||
COPY ./CMakeLists.txt .
|
||||
COPY ./src ./src
|
||||
ARG BUILD_TYPE=Debug
|
||||
|
||||
# run build
|
||||
RUN cd scripts && \
|
||||
chmod +x ./prepare_build.sh && \
|
||||
./prepare_build.sh && \
|
||||
mkdir ../build && \
|
||||
chmod +x ./build_debug.sh && \
|
||||
./build_debug.sh
|
||||
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 debug_builded
|
||||
FROM alpine-build as alpine-libs
|
||||
|
||||
USER root
|
||||
ENV DOCKER_WORKDIR="/code"
|
||||
# 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
|
||||
|
||||
RUN mkdir -p ${DOCKER_WORKDIR}
|
||||
WORKDIR ${DOCKER_WORKDIR}
|
||||
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# copy CMake from last stage
|
||||
COPY --from=build_debug_dependencies /usr/local/bin/cmake /usr/local/bin/cmake
|
||||
COPY --from=build_debug_dependencies /usr/local/share/cmake-3.19 /usr/local/share/cmake-3.19
|
||||
|
||||
COPY --from=build_debug_dependencies /code/build/bin ${DOCKER_WORKDIR}/pre_build/bin
|
||||
COPY --from=build_debug_dependencies /code/build/lib ${DOCKER_WORKDIR}/pre_build/lib
|
||||
|
||||
# grpc
|
||||
COPY --from=build_debug_dependencies /code/build/dependencies/grpc/lib ${DOCKER_WORKDIR}/pre_build/dependencies/grpc/lib
|
||||
COPY --from=build_debug_dependencies /code/build/dependencies/grpc/third_party/protobuf/lib ${DOCKER_WORKDIR}/pre_build/dependencies/grpc/third_party/protobuf/lib
|
||||
COPY --from=build_debug_dependencies /code/build/dependencies/grpc/third_party/re2/lib ${DOCKER_WORKDIR}/pre_build/dependencies/grpc/third_party/re2/lib
|
||||
COPY --from=build_debug_dependencies /code/build/dependencies/grpc/third_party/zlib/lib ${DOCKER_WORKDIR}/pre_build/dependencies/grpc/third_party/zlib/lib
|
||||
COPY --from=build_debug_dependencies /code/build/dependencies/grpc/third_party/cares/cares/lib ${DOCKER_WORKDIR}/pre_build/dependencies/grpc/third_party/cares/cares/lib
|
||||
COPY --from=build_debug_dependencies /code/build/dependencies/mariadb-connector-c/libmariadb/lib ${DOCKER_WORKDIR}/pre_build/dependencies/mariadb-connector-c/libmariadb/lib
|
||||
# copy from grpc
|
||||
COPY --from=alpine-gxx-grpc /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
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user