This commit is contained in:
einhornimmond 2021-02-16 10:24:58 +01:00 committed by Ulf Gebhardt
commit 4c6e2d0317
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD

View File

@ -1,68 +1,170 @@
# Build protoc #########################################################################################################
FROM gcc:7.5 as protoc_build # Build protoc
RUN git clone --recurse-submodules https://github.com/protocolbuffers/protobuf.git #########################################################################################################
WORKDIR /protobuf FROM gcc:7.5 as protoc_build
RUN git clone --recurse-submodules https://github.com/protocolbuffers/protobuf.git
RUN git checkout v3.9.1 WORKDIR /protobuf
RUN ./autogen.sh
RUN ./configure --enable-static=yes RUN git checkout v3.9.1
RUN make -j$(grep processor /proc/cpuinfo | wc -l) RUN ./autogen.sh
RUN make check RUN ./configure --enable-static=yes
RUN make -j$(grep processor /proc/cpuinfo | wc -l)
CMD ["./protobuf"] RUN make check
CMD ["./protobuf"]
# Build #########################################################################################################
From conanio/gcc7 as build # Build debug
#########################################################################################################
ENV DOCKER_WORKDIR="/code" From conanio/gcc7 as debug
USER root ENV DOCKER_WORKDIR="/code"
#RUN apt-get update && \
# apt-get install -y --no-install-recommends protobuf-compiler libprotobuf-dev && \ USER root
# apt-get autoclean && \ RUN apt-get update && \
# apt-get autoremove && \ apt-get install -y --no-install-recommends gdb && \
# apt-get clean && \ apt-get autoclean && \
# rm -rf /var/lib/apt/lists/* apt-get autoremove && \
apt-get clean && \
#RUN grep processor /proc/cpuinfo | wc -l rm -rf /var/lib/apt/lists/*
COPY --from=protoc_build /protobuf/src/.libs/protoc /usr/bin/ COPY --from=protoc_build /protobuf/src/.libs/protoc /usr/bin/
COPY --from=protoc_build /protobuf/src/.libs/libprotobuf.so.20.0.1 /usr/lib/libprotobuf.so.20 COPY --from=protoc_build /protobuf/src/.libs/libprotobuf.so.20.0.1 /usr/lib/libprotobuf.so.20
COPY --from=protoc_build /protobuf/src/.libs/libprotoc.so.20.0.1 /usr/lib/libprotoc.so.20 COPY --from=protoc_build /protobuf/src/.libs/libprotoc.so.20.0.1 /usr/lib/libprotoc.so.20
COPY --from=protoc_build /protobuf/src/google/protobuf/*.proto /usr/include/google/protobuf/ COPY --from=protoc_build /protobuf/src/google/protobuf/*.proto /usr/include/google/protobuf/
COPY --from=protoc_build /protobuf/src/google/protobuf/*.h /usr/include/google/protobuf/ COPY --from=protoc_build /protobuf/src/google/protobuf/*.h /usr/include/google/protobuf/
RUN mkdir -p ${DOCKER_WORKDIR} RUN mkdir -p ${DOCKER_WORKDIR}
WORKDIR ${DOCKER_WORKDIR} WORKDIR ${DOCKER_WORKDIR}
COPY . . COPY . .
RUN git submodule update --init --recursive #RUN git submodule update --init --recursive
RUN ls -la RUN ls -la
RUN cd dependencies/iroha-ed25519 && \ RUN cd dependencies/iroha-ed25519 && \
ls -la && \ ls -la && \
mkdir build && \ mkdir build && \
cd build && \ cd build && \
cmake .. -DEDIMPL=ref10 -DHASH=sha2_sphlib -DRANDOM=bcryptgen -DBUILD=STATIC && \ cmake .. -DCMAKE_BUILD_TYPE=Debug -DEDIMPL=ref10 -DHASH=sha2_sphlib -DRANDOM=bcryptgen -DBUILD=STATIC && \
make -j$(grep processor /proc/cpuinfo | wc -l) make -j$(grep processor /proc/cpuinfo | wc -l)
RUN cd dependencies/mariadb-connector-c && \ RUN cd dependencies/mariadb-connector-c && \
mkdir build && \ mkdir build && \
cd build && \ cd build && \
cmake -DWITH_SSL=OFF .. cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_SSL=OFF ..
#RUN conan profile update settings.compiler.libcxx=libstdc++11 default #RUN conan profile update settings.compiler.libcxx=libstdc++11 default
RUN chmod +x compile_proto.sh RUN chmod +x compile_proto.sh
RUN chmod +x compile_pot.sh RUN chmod +x compile_pot.sh
RUN ls -la RUN ls -la
RUN ./compile_pot.sh RUN ./compile_pot.sh
RUN ./compile_proto.sh RUN ./compile_proto.sh
RUN mkdir build && \ RUN mkdir build && \
cd build && \ cd build && \
conan install .. --build=missing && \ conan install .. --build=missing -s build_type=Debug && \
cmake .. && \ cmake -DCMAKE_BUILD_TYPE=Debug .. && \
make -j$(grep processor /proc/cpuinfo | wc -l) make -j$(grep processor /proc/cpuinfo | wc -l)
# deploy
#From #########################################################################################################
# Build release
#########################################################################################################
From conanio/gcc7 as release
ENV DOCKER_WORKDIR="/code"
USER root
#RUN apt-get update && \
# apt-get install -y --no-install-recommends protobuf-compiler libprotobuf-dev && \
# apt-get autoclean && \
# apt-get autoremove && \
# apt-get clean && \
# rm -rf /var/lib/apt/lists/*
#RUN grep processor /proc/cpuinfo | wc -l
COPY --from=protoc_build /protobuf/src/.libs/protoc /usr/bin/
COPY --from=protoc_build /protobuf/src/.libs/libprotobuf.so.20.0.1 /usr/lib/libprotobuf.so.20
COPY --from=protoc_build /protobuf/src/.libs/libprotoc.so.20.0.1 /usr/lib/libprotoc.so.20
COPY --from=protoc_build /protobuf/src/google/protobuf/*.proto /usr/include/google/protobuf/
COPY --from=protoc_build /protobuf/src/google/protobuf/*.h /usr/include/google/protobuf/
RUN mkdir -p ${DOCKER_WORKDIR}
WORKDIR ${DOCKER_WORKDIR}
COPY . .
#RUN git submodule update --init --recursive
RUN ls -la
RUN cd dependencies/iroha-ed25519 && \
ls -la && \
mkdir build && \
cd build && \
cmake .. -DEDIMPL=ref10 -DHASH=sha2_sphlib -DRANDOM=bcryptgen -DBUILD=STATIC && \
make -j$(grep processor /proc/cpuinfo | wc -l)
RUN cd dependencies/mariadb-connector-c && \
mkdir build && \
cd build && \
cmake -DWITH_SSL=OFF ..
#RUN conan profile update settings.compiler.libcxx=libstdc++11 default
RUN chmod +x compile_proto.sh
RUN chmod +x compile_pot.sh
RUN ls -la
RUN ./compile_pot.sh
RUN ./compile_proto.sh
RUN mkdir build && \
cd build && \
conan install .. --build=missing && \
cmake .. && \
make -j$(grep processor /proc/cpuinfo | wc -l) Gradido_LoginServer
RUN ls -la *
RUN ls -la build/*
RUN ls -la build/bin/
CMD ["./code"]
#########################################################################################################
# run release
#########################################################################################################
#From alpine:latest as login_server
FROM alpine:latest as login_server
WORKDIR "/usr/bin"
COPY --from=release /code/build/bin/Gradido_LoginServer /usr/bin/
COPY --from=release /code/build/lib/libmariadb.so.3 /usr/lib/
COPY start_after_mysql.sh .
RUN chmod +x /usr/bin/Gradido_LoginServer
#ENTRYPOINT ["/usr/bin/Gradido_LoginServer"]
# Wait on mariadb to started
#CMD ["sleep 5", "/usr/bin/Gradido_LoginServer"]
RUN chmod +x ./start_after_mysql.sh
#CMD ./start_after_mysql.sh
ENTRYPOINT ["/usr/bin/Gradido_LoginServer"]
CMD Gradido_LoginServer
#########################################################################################################
# run debug
#########################################################################################################
FROM alpine:latest as login_server_debug
WORKDIR "/usr/bin"
RUN apt-get update && \
apt-get install -y --no-install-recommends gdb && \
apt-get autoclean && \
apt-get autoremove && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
COPY --from=debug /code/build/bin/Gradido_LoginServer /usr/bin/
COPY --from=debug /code/build/lib/libmariadb.so.3 /usr/lib/
COPY start_after_mysql.sh .
RUN chmod +x /usr/bin/Gradido_LoginServer
#ENTRYPOINT ["/usr/bin/Gradido_LoginServer"]
# Wait on mariadb to started
#CMD ["sleep 5", "/usr/bin/Gradido_LoginServer"]
RUN chmod +x ./start_after_mysql.sh
ENTRYPOINT ["/usr/bin/Gradido_LoginServer"]
CMD Gradido_LoginServer