From 61fb275803db2252aa9465624f12ce5615d2679d Mon Sep 17 00:00:00 2001 From: Fanch Date: Thu, 11 Jul 2024 20:34:21 +0200 Subject: [PATCH] passage docker paheko upstream --- dockers/paheko/Dockerfile | 75 +++------------------ dockers/paheko/build.sh | 27 -------- dockers/paheko/composer-setup.sh | 18 ----- dockers/paheko/config/config.local.tmpl.php | 5 +- dockers/paheko/docker-compose.yml | 8 +-- 5 files changed, 14 insertions(+), 119 deletions(-) delete mode 100755 dockers/paheko/composer-setup.sh diff --git a/dockers/paheko/Dockerfile b/dockers/paheko/Dockerfile index 0e7ffd0..4bcf35c 100644 --- a/dockers/paheko/Dockerfile +++ b/dockers/paheko/Dockerfile @@ -1,67 +1,7 @@ -FROM php:8.2-apache +FROM paheko/paheko:1.3.10 -# pour upgrader paheko, il suffit de modifier le numéro de version ici -ENV PAHEKO_VERSION 1.3.9 - -ENV PAHEKO_DOWNLOAD_DIR download/paheko -ENV PAHEKO_DIR /usr/share/paheko - -######################################## -# APT local cache -# work around because COPY failed if no source file -#COPY .dummy .apt-mirror-confi[g] .proxy-confi[g] / -#RUN cp /.proxy-config /etc/profile.d/proxy.sh 2> /dev/null || true -#RUN if [ -f /.apt-mirror-config ] ; then . /.apt-mirror-config && sed -i \ -# -e "s/deb.debian.org/${APT_MIRROR_DEBIAN}/g" \ -# -e "s/security.debian.org/${APT_MIRROR_DEBIAN_SECURITY}/g" \ -# -e "s/archive.ubuntu.com/${APT_MIRROR_UBUNTU}/g" \ -# -e "s/security.ubuntu.com/${APT_MIRROR_UBUNTU_SECURITY}/g" \ -# /etc/apt/sources.list; fi - -######################################## -RUN apt-get update --quiet && apt-get install -y \ - libicu-dev libpq-dev zlib1g-dev libicu-dev \ - libzip-dev git wget zip patch imagemagick libmagickwand-dev; \ - pecl install imagick; \ - docker-php-ext-install zip; \ - docker-php-ext-enable imagick; - -#install composer setup script -COPY dockers/paheko/composer-setup.sh /usr/local/bin/ -RUN chmod +x /usr/local/bin/composer-setup.sh - -#install internationalization libs -RUN docker-php-ext-configure intl -RUN docker-php-ext-install intl -RUN docker-php-ext-install -j$(nproc) pdo ctype -RUN /usr/local/bin/composer-setup.sh - -ADD "${PAHEKO_DOWNLOAD_DIR}/paheko-${PAHEKO_VERSION}.tar.gz" /usr/share/ -RUN mv /usr/share/paheko-${PAHEKO_VERSION} ${PAHEKO_DIR} - - -RUN echo '\n\ - Options -MultiViews\n\ -\n\ -\n\ -php_value upload_max_filesize 100M\n\ -php_value post_max_size 100M\n\ -php_value memory_limit 256M\n\ -FallbackResource /_route.php\n\ -'> ${PAHEKO_DIR}/www/.htaccess - -#install prince pour génération pdf -RUN curl https://www.princexml.com/download/prince_20230609-1_debian12_amd64.deb --output prince.deb -RUN apt-get install libdeflate0 libjbig0 libjpeg62-turbo -y - -#on récupère 2 paquets de sécu sur bullseyes (me demande pas pourquoi) -RUN curl http://security.debian.org/debian-security/pool/updates/main/libw/libwebp/libwebp6_0.6.1-2.1+deb11u2_amd64.deb --output libwebp6_0.6.1.deb -RUN curl http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.1_1.1.1n-0+deb11u5_amd64.deb --output libssl1.1_1.1.deb -RUN dpkg -i libwebp6_0.6.1.deb -RUN dpkg -i libssl1.1_1.1.deb -RUN apt-get install libfontconfig1 libgif7 libjpeg62-turbo liblcms2-2 libtiff5-dev -y -RUN apt-get install libaom3 libavif15 -y -RUN dpkg -i prince.deb +#ENV PAHEKO_DIR /usr/share/paheko +ENV PAHEKO_DIR /var/www/paheko COPY dockers/paheko/config/factory_cron.sh ${PAHEKO_DIR}/ COPY dockers/paheko/config/factory_cron_emails.sh ${PAHEKO_DIR}/ @@ -72,9 +12,6 @@ RUN mkdir ${PAHEKO_DIR}/users COPY "dockers/paheko/config/facturation.tar.gz" ${PAHEKO_DIR}/data/plugins/ RUN mkdir ${PAHEKO_DIR}/data/plugins/facturation && tar zxvf ${PAHEKO_DIR}/data/plugins/facturation.tar.gz -C ${PAHEKO_DIR}/data/plugins/facturation && rm ${PAHEKO_DIR}/data/plugins/facturation.tar.gz -#fab: pour eviter l'anomalie: $msg mustn't contain any NULL byte -#RUN sed -i "394i\$msg = str_replace(chr(0), '', \$msg);" ${PAHEKO_DIR}/include/lib/KD2/ErrorManager.php - #install cron pour factory_cron.sh RUN apt-get install cron joe rsyslog -y RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf @@ -84,11 +21,15 @@ RUN chmod 600 /var/spool/cron/crontabs/root RUN sed -i "/exec/i\service cron start\n" /usr/local/bin/docker-php-entrypoint RUN ln -sf /usr/local/bin/php /usr/bin/ +#outil pour debugger dans le docker +RUN apt-get install -y inetutils-ping net-tools + # Set owner web server RUN chown -R www-data: ${PAHEKO_DIR} #fab le 03/02/2023: pour avoir un php.ini de prod avec zend.assertions = -1 RUN cp "/usr/local/etc/php/php.ini-production" "/usr/local/etc/php/php.ini" +HEALTHCHECK --timeout=10s CMD exit 0 EXPOSE 80 -VOLUME [ "/usr/share/paheko/users" ] +VOLUME [ "${PAHEKO_DIR}/users" ] diff --git a/dockers/paheko/build.sh b/dockers/paheko/build.sh index e768b07..b8db49a 100755 --- a/dockers/paheko/build.sh +++ b/dockers/paheko/build.sh @@ -4,33 +4,6 @@ KAZ_ROOT=$(cd "$(dirname $0)/../.."; pwd) . "${KAZ_ROOT}/bin/.commonFunctions.sh" setKazVars -###########################################################################" -#on récupère la dernière version de paheko et tous les plugin - -PAHEKO_VER=$(grep "^ENV PAHEKO_VERSION" Dockerfile | awk '{print $3}') -#FCT_VER="0.8.5" -echo "VERSION PAHEKO : $PAHEKO_VER" -#echo "VERSION FACTURATION : $FCT_VER" - -downloadFile () { - # $1 URL to download - if [ ! -f "$(basename "$1")" ]; then - printKazMsg " - load $1" - curl -L -O "$1" - fi -} - -mkdir -p "${KAZ_DNLD_DIR}/paheko" -cd "${KAZ_DNLD_DIR}/paheko" - -#pour être certain de récupérer les dernières versions de plugin -rm * -f - -printKazMsg "\n *** Download paheko on ${KAZ_DNLD_DIR}" - -downloadFile "https://fossil.kd2.org/paheko/uv/paheko-${PAHEKO_VER}.tar.gz" - -########################################################################### printKazMsg "\n *** Création du Dockerfile paheko" cd "${KAZ_ROOT}" diff --git a/dockers/paheko/composer-setup.sh b/dockers/paheko/composer-setup.sh deleted file mode 100755 index 1eb0ad7..0000000 --- a/dockers/paheko/composer-setup.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -EXPECTED_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig) -php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" -ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');") - -if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ] -then - >&2 echo 'ERROR: Invalid installer signature' - rm composer-setup.php - exit 1 -fi - -php composer-setup.php --quiet -RESULT=$? -rm composer-setup.php -exit $RESULT - diff --git a/dockers/paheko/config/config.local.tmpl.php b/dockers/paheko/config/config.local.tmpl.php index b2113da..3a0922f 100644 --- a/dockers/paheko/config/config.local.tmpl.php +++ b/dockers/paheko/config/config.local.tmpl.php @@ -98,7 +98,7 @@ define('Paheko\DATA_ROOT', $user_data_dir); const PREFER_HTTPS = false; const SMTP_HOST = "__SMTP_HOST__.__DOMAIN__"; const SMTP_USER = null; -const API_USER = "__PAHEKO_API_USER__"; +const API_USER = "__PAHEKO_API_USER__"; const API_PASSWORD = "__PAHEKO_API_PASSWORD__"; const SMTP_PASSWORD = null; const SMTP_PORT = 25; @@ -126,4 +126,5 @@ define('Paheko\SHOW_ERRORS', true); #add by fab le 21/04/2022 //const PDF_COMMAND = 'prince'; -const PDF_COMMAND = 'auto'; +# const PDF_COMMAND = 'auto'; +const PDF_COMMAND = 'chromium --no-sandbox --headless --disable-dev-shm-usage --autoplay-policy=no-user-gesture-required --no-first-run --disable-gpu --disable-features=DefaultPassthroughCommandDecoder --use-fake-ui-for-media-stream --use-fake-device-for-media-stream --disable-sync --print-to-pdf=%2$s %1$s'; diff --git a/dockers/paheko/docker-compose.yml b/dockers/paheko/docker-compose.yml index 227376e..f3a43c1 100644 --- a/dockers/paheko/docker-compose.yml +++ b/dockers/paheko/docker-compose.yml @@ -7,11 +7,9 @@ services: build: . container_name: ${pahekoServName} volumes: - - ./config/paheko.conf:/etc/apache2/sites-available/000-default.conf - - ./config/config.local.php:/usr/share/paheko/config.local.php - - ./config/factory_cron.sh:/usr/share/paheko/factory_cron.sh -# - ./config/cron.php:/usr/share/paheko/scripts/cron.php - - assoUsers:/usr/share/paheko/users + - ./config/config.local.php:/var/www/paheko/config.local.php + - ./config/factory_cron.sh:/var/www/paheko/factory_cron.sh + - assoUsers:/var/www/paheko/users - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro # ports: