From c4e3b65b47e9c89bead9db8a2cde74398af9346e Mon Sep 17 00:00:00 2001 From: Ivan Kuchin Date: Fri, 3 Jun 2022 15:15:54 -0400 Subject: [PATCH] Infrastructure: dynamic insertion of wkhtmltox into .deb --- supplemental/docker/prod/Dockerfile | 24 ++++++++++++++---------- supplemental/docker/qa/Dockerfile | 18 ++++++++++-------- wkhtmltox/readme | 1 + 3 files changed, 25 insertions(+), 18 deletions(-) create mode 100644 wkhtmltox/readme diff --git a/supplemental/docker/prod/Dockerfile b/supplemental/docker/prod/Dockerfile index 9de585c..190e995 100644 --- a/supplemental/docker/prod/Dockerfile +++ b/supplemental/docker/prod/Dockerfile @@ -93,12 +93,6 @@ RUN apt update \ wget \ && apt-get clean -############################# -# libwkhtmltox installation # -############################# -RUN wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.trusty_amd64.deb -RUN apt install --no-install-recommends --no-install-suggests -y ./wkhtmltox_0.12.5-1.trusty_amd64.deb - ############################# # libwebsocket installation # ############################# @@ -124,6 +118,14 @@ RUN if test -f "./libxl-3.8.4.0/lib64/libxl.so"; then \ && ldconfig; \ fi +############################# +# libwkhtmltox installation # +############################# +RUN if test -d "./wkhtmltox"; then \ + wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.trusty_amd64.deb \ + && apt install --no-install-recommends --no-install-suggests -y ./wkhtmltox*.deb; \ + fi + ################## # save commit id # ################## @@ -169,9 +171,7 @@ RUN cd build \ -DLOCAL_INSTALL_DIR=${LOCAL_INSTALL_DIR} \ -DBUILD_RELEASE_NUMBER=${BUILD_RELEASE_NUMBER} \ .. \ - && make -j2 package \ - && make install \ - && make clean + && make -j2 package # EXPOSE 80 @@ -218,6 +218,11 @@ COPY --from=build ${GIT_FOLDER}/supplemental/apache2/ /etc/apache2/ COPY --from=build /usr/local/lib/libxl* /usr/local/lib/ RUN ldconfig +################### +# copy wkhtmltox # +################### +COPY --from=build ${GIT_FOLDER}/wkhtmltox*.deb ./ + #################### # install binaries # #################### @@ -228,7 +233,6 @@ RUN apt update \ apache2 \ gsfonts \ wget \ - && wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.trusty_amd64.deb \ && apt install --no-install-recommends --no-install-suggests -y ./*.deb \ && apt remove -y wget \ && rm -rf /var/lib/apt/lists/* diff --git a/supplemental/docker/qa/Dockerfile b/supplemental/docker/qa/Dockerfile index 9259027..1101edd 100644 --- a/supplemental/docker/qa/Dockerfile +++ b/supplemental/docker/qa/Dockerfile @@ -41,7 +41,8 @@ RUN apt-get install --no-install-recommends --no-install-suggests -y \ libwebp-dev \ libarchive-dev \ rapidjson-dev \ - pkg-config + pkg-config \ + wget ##################### # locale generation # @@ -52,13 +53,6 @@ RUN locale-gen en_US.utf8 RUN update-locale RUN export LC_ALL=en_US.utf8 -############################# -# libwkhtmltox installation # -############################# -RUN apt-get install --no-install-recommends --no-install-suggests -y wget -RUN wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.trusty_amd64.deb -RUN apt install --no-install-recommends --no-install-suggests -y ./wkhtmltox_0.12.5-1.trusty_amd64.deb - ############### # pull PI src # ############### @@ -74,6 +68,14 @@ RUN if test -f "./libxl-3.8.4.0/lib64/libxl.so"; then \ && ldconfig; \ fi +############################# +# libwkhtmltox installation # +############################# +RUN if test -d "./wkhtmltox"; then \ + wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.trusty_amd64.deb \ + && apt install --no-install-recommends --no-install-suggests -y ./wkhtmltox*.deb; \ + fi + ################## # save commit id # ################## diff --git a/wkhtmltox/readme b/wkhtmltox/readme new file mode 100644 index 0000000..d769d03 --- /dev/null +++ b/wkhtmltox/readme @@ -0,0 +1 @@ +This folder instructs Docker to install wkhtmltox library, otherwise it won't be installed. \ No newline at end of file