diff --git a/.gitignore b/.gitignore index 79bf978..0852fe2 100644 --- a/.gitignore +++ b/.gitignore @@ -124,3 +124,5 @@ checks-parser deploy/appimage/AppDir/usr/share/doc/ deploy/appimage/AppDir/usr/share/ *.deb + +binaries diff --git a/deploy/Docker/archlinux/Dockerfile b/deploy/Docker/archlinux/Dockerfile deleted file mode 100644 index 0c32f98..0000000 --- a/deploy/Docker/archlinux/Dockerfile +++ /dev/null @@ -1,34 +0,0 @@ -FROM archlinux - -#Update -RUN pacman --noconfirm -Sy - -#Build dependencies -RUN pacman --noconfirm -S sudo cmake git coreutils base-devel qt5-base - -RUN echo "MAKEFLAGS=\"-j${nproc}\"" >> /etc/makepkg.conf - -RUN useradd -ms /bin/bash checks-parser -RUN usermod -a -G wheel checks-parser - -RUN echo "checks-parser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers -USER checks-parser -WORKDIR /home/checks-parser - -#Dependencies from sources -RUN git clone https://aur.archlinux.org/yay.git && \ - cd yay && \ - makepkg -si --noconfirm && \ - cd .. && sudo rm -rf yay - -RUN yay -S opencv zbar nlohmann-json tesseract tesseract-data-rus - -#building -WORKDIR /home/checks-parser -RUN git clone https://git.foxarmy.org/leca/checks-parser && \ - cd checks-parser && \ - cmake . && \ - make -j ${nproc} && \ - sudo make install - -ENTRYPOINT ["checks-parser"] diff --git a/deploy/Docker/debian/Dockerfile b/deploy/Docker/debian/Dockerfile deleted file mode 100644 index 6a3586f..0000000 --- a/deploy/Docker/debian/Dockerfile +++ /dev/null @@ -1,34 +0,0 @@ -FROM debian:bullseye - -#Update -RUN apt update -y && apt upgrade -y - -#Build dependencies -RUN apt install -y git build-essential cmake - -#Dependencies from repos (qt5, openssl, tesseract and lang package) -RUN apt install -y qtbase5-dev openssl libmbedtls-dev tesseract-ocr tesseract-ocr-rus libopencv-dev - -#Dependencies from sources -#cpr -WORKDIR /root -RUN git clone https://github.com/whoshuu/cpr.git && \ - cd cpr && \ - mkdir build && cd build && \ - cmake .. && \ - make -j ${nproc} && \ - make install && \ - cd /root && rm -rf cpr - - -#building - -WORKDIR /root -RUN git clone https://git.foxarmy.org/leca/checks-parser && \ - cd checks-parser && \ - mkdir build && cd build &&\ - cmake .. && \ - make -j ${nproc} && \ - make install && \ - -ENTRYPOINT ["checks-parser"] diff --git a/deploy/appimage/Dockerfile b/deploy/appimage/Dockerfile index b0e1b16..7f8086a 100644 --- a/deploy/appimage/Dockerfile +++ b/deploy/appimage/Dockerfile @@ -1,11 +1,9 @@ -FROM ubuntu:16.04 +FROM checks_parser_base -# Installing dependencies -RUN apt update - -RUN DEBIAN_FRONTEND=noninteractive apt install -y qtbase5-dev openssl libmbedtls-dev tesseract-ocr tesseract-ocr-rus libopencv-dev libzbar-dev qttools5-dev nlohmann-json-dev libcurl4-openssl-dev libtesseract-dev libqrencode-dev +RUN DEBIAN_FRONTEND=noninteractive apt update RUN DEBIAN_FRONTEND=noninteractive apt install -y wget git cmake make gcc g++ fuse libboost-regex-dev + WORKDIR / # Download linuxdeployqt @@ -13,44 +11,16 @@ RUN wget https://github.com/probonopd/linuxdeployqt/releases/download/continuous chmod +x /usr/bin/linuxdeployqt # Prepare AppDir and its files -WORKDIR /appimage -RUN mkdir -p AppDir +WORKDIR /app + +RUN mkdir -p AppDir/usr/bin COPY deploy/appimage/checks-parser.desktop AppDir COPY assets/icons/icon.png AppDir/checks-parser.png COPY deploy/appimage/AppRun AppDir RUN chmod +x AppDir/AppRun +RUN cp build/checks-parser /app/AppDir/usr/bin -#Copy only necessities -COPY assets ./assets -COPY check ./check -COPY exceptions ./exceptions -COPY goods ./goods -COPY image ./image -COPY image_redactor ./image_redactor -COPY output ./output -COPY parser ./parser -COPY settings ./settings -COPY scenes ./scenes -COPY net ./net -COPY translations ./translations -COPY http_server ./http_server -COPY utils ./utils - -COPY ./*.h ./*cpp ./*.ui ./*.qrc CMakeLists.txt . - -RUN mkdir build -WORKDIR /appimage/build - -RUN cmake -DBUILD_TRANSLATIONS=on .. && make -j 8 - -WORKDIR /appimage/AppDir/usr/bin - -RUN cp /appimage/build/checks-parser . - -WORKDIR /appimage - -RUN PATH=/usr/lib/qt5/bin/:$PATH linuxdeployqt --appimage-extract-and-run AppDir/usr/bin/checks-parser -no-copy-copyright-files -appimage - +RUN PATH=/usr/lib/qt5/bin/:$PATH linuxdeployqt --appimage-extract-and-run AppDir/usr/bin/checks-parser -no-copy-copyright-files -appimage RUN mkdir -p /output ENTRYPOINT ["cp", "Checks_parser-x86_64.AppImage", "/output"] diff --git a/deploy/base-docker/Dockerfile b/deploy/base-docker/Dockerfile new file mode 100644 index 0000000..ed40002 --- /dev/null +++ b/deploy/base-docker/Dockerfile @@ -0,0 +1,33 @@ +FROM ubuntu:18.04 + +# Installing dependencies +RUN apt update + +RUN DEBIAN_FRONTEND=noninteractive apt install -y qtbase5-dev openssl libmbedtls-dev tesseract-ocr tesseract-ocr-rus libopencv-dev libzbar-dev qttools5-dev nlohmann-json-dev libcurl4-openssl-dev libtesseract-dev libqrencode-dev +RUN DEBIAN_FRONTEND=noninteractive apt install -y wget git cmake make gcc g++ fuse libboost-regex-dev + +WORKDIR /app + +#Copy only necessities +COPY assets ./assets +COPY check ./check +COPY exceptions ./exceptions +COPY goods ./goods +COPY image ./image +COPY image_redactor ./image_redactor +COPY output ./output +COPY parser ./parser +COPY settings ./settings +COPY scenes ./scenes +COPY net ./net +COPY translations ./translations +COPY http_server ./http_server +COPY utils ./utils + +COPY ./*.h ./*cpp ./*.ui ./*.qrc CMakeLists.txt . + +WORKDIR /app/build + +RUN cmake -DBUILD_TRANSLATIONS=on .. && make -j 8 + +ENTRYPOINT ["bash"] diff --git a/docker-compose.yml b/docker-compose.yml index 9e8b429..dd4cb3a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,14 @@ services: + base: + image: checks_parser_base:latest + build: + context: . + dockerfile: deploy/base-docker/Dockerfile appimage: build: dockerfile: deploy/appimage/Dockerfile context: . volumes: - ./binaries:/output + depends_on: + - base