Merge pull request #103 from gradido/build_on_run

Build on run
This commit is contained in:
einhornimmond 2021-03-30 16:10:28 +02:00 committed by GitHub
commit 2e178360f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 223 additions and 231 deletions

View File

@ -1,77 +1,65 @@
version: "3.4"
services:
########################################################
# FRONTEND #############################################
########################################################
frontend:
image: gradido/frontend:development
build:
target: development
environment:
- NODE_ENV="development"
# - DEBUG=true
- NUXT_BUILD=/tmp/nuxt # avoid file permission issues when `rm -rf .nuxt/`
volumes:
# This makes sure the docker container has its own node modules.
# Therefore it is possible to have a different node version on the host machine
- frontend_node_modules:/app/node_modules
# bind the local folder to the docker to allow live reload
- ./frontend:/app
#########################################################
## LOGIN SERVER #########################################
#########################################################
login-server:
build:
target: login_server_debug
dockerfile: Dockerfile.debug
security_opt:
- seccomp:unconfined
cap_add:
- SYS_PTRACE
volumes:
- ./logs:/var/log/grd_login
- conan:/root/.conan
#########################################################
## NGINX ################################################
#########################################################
nginx:
volumes:
- ./logs:/var/log/nginx
#########################################################
## PHPMYADMIN ###########################################
#########################################################
phpmyadmin:
image: phpmyadmin
container_name: phpmyadmin
environment:
- PMA_ARBITRARY=1
#restart: always
ports:
- 8074:80
networks:
- internal-net
- external-net
volumes:
- /sessions
#########################################################
## skeema for updating dbs if changes happend ###########
#########################################################
skeema:
build:
context: .
dockerfile: ./skeema/Dockerfile
target: skeema_run
container_name: skeema
depends_on:
- mariadb
networks:
- internal-net
volumes:
frontend_node_modules:
conan:
version: "3.4"
services:
########################################################
# FRONTEND #############################################
########################################################
frontend:
image: gradido/frontend:development
build:
target: development
environment:
- NODE_ENV="development"
# - DEBUG=true
- NUXT_BUILD=/tmp/nuxt # avoid file permission issues when `rm -rf .nuxt/`
volumes:
# This makes sure the docker container has its own node modules.
# Therefore it is possible to have a different node version on the host machine
- frontend_node_modules:/app/node_modules
# bind the local folder to the docker to allow live reload
- ./frontend:/app
#########################################################
## LOGIN SERVER #########################################
#########################################################
login-server:
build:
target: login_server_debug
dockerfile: Dockerfile.debug
security_opt:
- seccomp:unconfined
cap_add:
- SYS_PTRACE
volumes:
- ./logs:/var/log/grd_login
- ./login_server/src:/code/src
- login_build:/code/build_vol
#########################################################
## NGINX ################################################
#########################################################
nginx:
volumes:
- ./logs:/var/log/nginx
#########################################################
## PHPMYADMIN ###########################################
#########################################################
phpmyadmin:
image: phpmyadmin
container_name: phpmyadmin
environment:
- PMA_ARBITRARY=1
#restart: always
ports:
- 8074:80
networks:
- internal-net
- external-net
volumes:
- /sessions
volumes:
frontend_node_modules:
login_build:

View File

@ -1,18 +1,3 @@
#########################################################################################################
# Build protoc
#########################################################################################################
FROM gcc:7.5 as protoc_build
RUN git clone --recurse-submodules https://github.com/protocolbuffers/protobuf.git
WORKDIR /protobuf
RUN git checkout v3.9.1
RUN ./autogen.sh
RUN ./configure --enable-static=yes
RUN make -j$(grep processor /proc/cpuinfo | wc -l)
RUN make check
CMD ["./protobuf"]
#########################################################################################################
# Build release
#########################################################################################################
@ -22,11 +7,10 @@ ENV DOCKER_WORKDIR="/code"
USER root
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/
COPY --from=unicorny/protoc:3.9.1 /usr/bin/protoc /usr/bin/
COPY --from=unicorny/protoc:3.9.1 /usr/lib/libprotobuf.so.20 /usr/lib/libprotobuf.so.20
COPY --from=unicorny/protoc:3.9.1 /usr/lib/libprotoc.so.20 /usr/lib/libprotoc.so.20
COPY --from=unicorny/protoc:3.9.1 /usr/include/google/protobuf/* /usr/include/google/protobuf/
RUN mkdir -p ${DOCKER_WORKDIR}
@ -40,7 +24,7 @@ RUN cd dependencies/iroha-ed25519 && \
mkdir build && \
cd build && \
cmake .. -DEDIMPL=ref10 -DHASH=sha2_sphlib -DRANDOM=bcryptgen -DBUILD=STATIC && \
make -j$(grep processor /proc/cpuinfo | wc -l)
make -j$(nproc)
RUN cd dependencies/mariadb-connector-c && \
mkdir build && \
@ -56,7 +40,7 @@ RUN mkdir build && \
cd build && \
conan install .. --build=missing && \
cmake .. && \
make -j$(grep processor /proc/cpuinfo | wc -l) Gradido_LoginServer
make -j$(nproc) Gradido_LoginServer
CMD ["./code"]

View File

@ -1,132 +1,67 @@
#########################################################################################################
# Build protoc
#########################################################################################################
FROM gcc:7.5 as protoc_build
RUN git clone --recurse-submodules https://github.com/protocolbuffers/protobuf.git
WORKDIR /protobuf
RUN git checkout v3.9.1
RUN ./autogen.sh
RUN ./configure --enable-static=yes
RUN make -j$(grep processor /proc/cpuinfo | wc -l)
RUN make check
CMD ["./protobuf"]
#########################################################################################################
# debug build preparation
#########################################################################################################
From conanio/gcc7 as debug_preparation
ENV DOCKER_WORKDIR="/code"
USER root
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/
#VOLUME /root/.conan
RUN mkdir -p ${DOCKER_WORKDIR}
WORKDIR ${DOCKER_WORKDIR}
COPY ./dependencies ./dependencies
COPY ./conanfile.txt ./conanfile.txt
RUN ls -la
RUN cd dependencies/iroha-ed25519 && \
ls -la && \
mkdir build && \
cd build && \
cmake .. -DCMAKE_BUILD_TYPE=Debug -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 -DCMAKE_BUILD_TYPE=Debug -DWITH_SSL=OFF ..
#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 -s build_type=Debug
#########################################################################################################
# Build debug
#########################################################################################################
From debug_preparation as debug
ENV DOCKER_WORKDIR="/code"
USER root
#VOLUME /root/.conan
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=protoc_build /protobuf/src/.libs/libprotobuf.so.20.0.1 /usr/lib/libprotobuf.so.20
#COPY --from=protoc_build /protobuf/src/google/protobuf/*.h /usr/include/google/protobuf/
#COPY --from=debug_preparation /code /code
#COPY --from=debug_preparation /home/conan /home/conan
#RUN ls -la /home/conan/.conan
COPY . .
WORKDIR ${DOCKER_WORKDIR}
#RUN ls -la
#RUN cat build/conanbuildinfo.cmake
RUN chmod +x compile_proto.sh
RUN chmod +x compile_pot.sh
#RUN ls -la
RUN ./compile_pot.sh
RUN ./compile_proto.sh
RUN cd build && \
cmake -DCMAKE_BUILD_TYPE=Debug .. && \
make -j$(grep processor /proc/cpuinfo | wc -l)
#########################################################################################################
# run debug
#########################################################################################################
FROM ubuntu: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/*
VOLUME /var/log/grd_login
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
EXPOSE 1200
EXPOSE 1201
#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 gdb -ex=r Gradido_LoginServer
CMD Gradido_LoginServer
#########################################################################################################
# Build debug
#########################################################################################################
From gradido/login_dependencies:stage1 as debug
ENV DOCKER_WORKDIR="/code"
USER root
#VOLUME /root/.conan
#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=protoc_build /protobuf/src/.libs/libprotobuf.so.20.0.1 /usr/lib/libprotobuf.so.20
#COPY --from=protoc_build /protobuf/src/google/protobuf/*.h /usr/include/google/protobuf/
#COPY --from=debug_preparation /code /code
#COPY --from=debug_preparation /home/conan /home/conan
#RUN ls -la /home/conan/.conan
WORKDIR ${DOCKER_WORKDIR}
COPY . .
#RUN ls -la
#RUN cat build/conanbuildinfo.cmake
RUN chmod +x compile_proto.sh
RUN chmod +x compile_pot.sh
#RUN ls -la
RUN ./compile_pot.sh
RUN ./compile_proto.sh
#########################################################################################################
# run debug
#########################################################################################################
FROM debug as login_server_debug
ENV DOCKER_WORKDIR="/code"
#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/*
VOLUME /var/log/grd_login
VOLUME /code/src
EXPOSE 1200
EXPOSE 1201
WORKDIR ${DOCKER_WORKDIR}
RUN chmod +x ./Dockerfiles/build_and_run.sh
#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 gdb -ex=r Gradido_LoginServer
CMD ./Dockerfiles/build_and_run.sh

View File

@ -0,0 +1,46 @@
#########################################################################################################
# debug build preparation
#########################################################################################################
From conanio/gcc7 as debug_preparation
ENV DOCKER_WORKDIR="/code"
USER root
COPY --from=unicorny/protoc:3.9.1 /usr/bin/protoc /usr/bin/
COPY --from=unicorny/protoc:3.9.1 /usr/lib/libprotobuf.so.20 /usr/lib/libprotobuf.so.20
COPY --from=unicorny/protoc:3.9.1 /usr/lib/libprotoc.so.20 /usr/lib/libprotoc.so.20
COPY --from=unicorny/protoc:3.9.1 /usr/include/google/protobuf/* /usr/include/google/protobuf/
#VOLUME /root/.conan
RUN mkdir -p ${DOCKER_WORKDIR}
WORKDIR ${DOCKER_WORKDIR}
COPY ./dependencies ./dependencies
COPY ./conanfile.txt ./conanfile.txt
RUN ls -la
RUN cd dependencies/iroha-ed25519 && \
ls -la && \
mkdir build && \
cd build && \
cmake .. -DCMAKE_BUILD_TYPE=Debug -DEDIMPL=ref10 -DHASH=sha2_sphlib -DRANDOM=bcryptgen -DBUILD=STATIC && \
make -j$(nproc)
RUN cd dependencies/mariadb-connector-c && \
mkdir build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_SSL=OFF ..
#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 -s build_type=Debug

View File

@ -0,0 +1,30 @@
#########################################################################################################
# Build protoc
#########################################################################################################
FROM gcc:7.5 as protoc3.9.1_build
RUN git clone --recurse-submodules https://github.com/protocolbuffers/protobuf.git
WORKDIR /protobuf
RUN git checkout v3.9.1
RUN ./autogen.sh
RUN ./configure --enable-static=yes
RUN make -j$(nproc)
#RUN make check
CMD ["./protobuf"]
#########################################################################################################
# Store protoc
#########################################################################################################
FROM alpine:3.10 as protoc
COPY --from=protoc3.9.1_build /protobuf/src/.libs/protoc /usr/bin/
COPY --from=protoc3.9.1_build /protobuf/src/.libs/libprotobuf.so.20.0.1 /usr/lib/libprotobuf.so.20
COPY --from=protoc3.9.1_build /protobuf/src/.libs/libprotoc.so.20.0.1 /usr/lib/libprotoc.so.20
COPY --from=protoc3.9.1_build /protobuf/src/google/protobuf/*.proto /usr/include/google/protobuf/
COPY --from=protoc3.9.1_build /protobuf/src/google/protobuf/*.h /usr/include/google/protobuf/
## build with:
# docker build . -f Dockefile.protoc -t gradido/protoc:3.9.1
## upload (login to docker hub on shell before):
# docker push gradido/protoc:3.9.1

View File

@ -0,0 +1,9 @@
#!/bin/bash
cp build/conan* build_vol/
cd build_vol
cmake -DCMAKE_BUILD_TYPE=Debug ..
make -j$(nproc) Gradido_LoginServer
echo "building done"
chmod +x ./bin/Gradido_LoginServer
./bin/Gradido_LoginServer