diff --git a/build/docker/.dockerignore b/build/docker-dev/.dockerignore similarity index 100% rename from build/docker/.dockerignore rename to build/docker-dev/.dockerignore diff --git a/build/docker-dev/Dockerfile b/build/docker-dev/Dockerfile new file mode 100644 index 00000000000..5cd4c60673b --- /dev/null +++ b/build/docker-dev/Dockerfile @@ -0,0 +1,61 @@ +FROM php:8.1-apache-bullseye + +ENV PHP_INI_DATE_TIMEZONE 'UTC' +ENV PHP_INI_MEMORY_LIMIT 256M + +RUN apt-get update -y \ + && apt-get install -y --no-install-recommends \ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libjpeg62-turbo \ + libpng-dev \ + libpng16-16 \ + libldap2-dev \ + libxml2-dev \ + libzip-dev \ + zlib1g-dev \ + libicu-dev \ + g++ \ + default-mysql-client \ + unzip \ + curl \ + apt-utils \ + msmtp \ + msmtp-mta \ + mailutils \ + && apt-get autoremove -y \ + && rm -rf /var/lib/apt/lists/* \ + && docker-php-ext-configure gd --with-freetype --with-jpeg \ + && docker-php-ext-install -j$(nproc) calendar intl mysqli pdo_mysql gd soap zip \ + && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ + && docker-php-ext-install -j$(nproc) ldap && \ + mv ${PHP_INI_DIR}/php.ini-development ${PHP_INI_DIR}/php.ini + +RUN mkdir /var/documents +RUN chown www-data:www-data /var/documents + +COPY docker-run.sh /usr/local/bin/ +RUN chmod +x /usr/local/bin/docker-run.sh + +RUN pecl install xdebug && docker-php-ext-enable xdebug +RUN echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so"' >> ${PHP_INI_DIR}/php.ini +RUN echo 'xdebug.mode=debug' >> ${PHP_INI_DIR}/php.ini +RUN echo 'xdebug.start_with_request=yes' >> ${PHP_INI_DIR}/php.ini +RUN echo 'xdebug.client_host=host.docker.internal' >> ${PHP_INI_DIR}/php.ini +RUN echo 'xdebug.client_port=9003' >> ${PHP_INI_DIR}/php.ini +RUN echo 'xdebug.discover_client_host=true' >> ${PHP_INI_DIR}/php.ini +#RUN echo 'xdebug.log="/tmp/xdebug.log"' >> ${PHP_INI_DIR}/php.ini +RUN echo 'xdebug.idekey="netbeans-xdebug"' >> ${PHP_INI_DIR}/php.ini + +# set up sendmail config, to use maildev +RUN echo "account default" > /etc/msmtprc +RUN echo "auth off" >> /etc/msmtprc +RUN echo "port 1025" >> /etc/msmtprc +RUN echo "host mail" >> /etc/msmtprc +RUN echo "from local@localdomain.com" >> /etc/msmtprc +RUN echo "domain localhost.localdomain" >> /etc/msmtprc +RUN echo "sendmail_path=/usr/bin/msmtp -t" >> /usr/local/etc/php/conf.d/php-sendmail.ini + +EXPOSE 80 + +ENTRYPOINT ["docker-run.sh"] diff --git a/build/docker-dev/README.md b/build/docker-dev/README.md new file mode 100644 index 00000000000..6daf6d6bd5c --- /dev/null +++ b/build/docker-dev/README.md @@ -0,0 +1,34 @@ +# How to use it ? + +The docker-compose.yml file is a sample of a config file to use to build and run Dolibarr in the current workspace with Docker. +This docker image is intended for development usage. +For production usage you should consider other contributor reference like https://hub.docker.com/r/tuxgasy/dolibarr + +Before build/run, define the variable HOST_USER_ID as following: + + export HOST_USER_ID=$(id -u) + +Go in repository build/docker : + + cd build/docker + +And then, you can run : + + docker-compose up + +This will run 4 containers Docker : Dolibarr, MariaDB, PhpMyAdmin and MailDev. + +The URL to go to the Dolibarr is : + + http://0.0.0.0 + +The URL to go to PhpMyAdmin is (login/password is root/root) : + + http://0.0.0.0:8080 + +In Dolibarr configuration Email let PHP mail function, To see all mail send by Dolibarr go to maildev + + http://0.0.0.0:8081 + +Setup the database connection during the installation process, please use mariadb (name of the database container) as database host. +Setup documents folder, during the installation process, to /var/documents diff --git a/build/docker-dev/docker-compose.yml b/build/docker-dev/docker-compose.yml new file mode 100644 index 00000000000..cc2988a67d1 --- /dev/null +++ b/build/docker-dev/docker-compose.yml @@ -0,0 +1,62 @@ +version: '3' + +networks: + internal-pod: + internal: true + external-pod: + internal: false + +services: + mariadb: + image: mariadb:latest + environment: + MYSQL_ROOT_PASSWORD: rootpassfordev + MYSQL_DATABASE: dolibarr + ports: + - "3306:3306" + networks: + - internal-pod + - external-pod + + phpmyadmin: + image: phpmyadmin/phpmyadmin + environment: + PMA_HOST: mariadb + depends_on: + - mariadb + ports: + - "8080:80" + networks: + - internal-pod + - external-pod + + web: + build: . + environment: + HOST_USER_ID: $HOST_USER_ID + PHP_INI_DATE_TIMEZONE: $PHP_INI_DATE_TIMEZONE + PHP_INI_MEMORY_LIMIT: $PHP_INI_MEMORY_LIMIT + volumes: + - ../../htdocs:/var/www/html/ + - ../../documents:/var/documents + ports: + - "80:80" + - "9000:9000" + depends_on: + - mariadb + - mail + networks: + - internal-pod + - external-pod + extra_hosts: + - "localhost.localdomain:127.0.0.1" + - "host.docker.internal:host-gateway" + + mail: + image: maildev/maildev + ports: + - "8081:1080" + - "25:1025" + networks: + - internal-pod + - external-pod diff --git a/build/docker-dev/docker-run.sh b/build/docker-dev/docker-run.sh new file mode 100755 index 00000000000..07bc35947cf --- /dev/null +++ b/build/docker-dev/docker-run.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Script used by the Dockerfile. +# See README.md to know how to create a Dolibarr env with docker + +usermod -u "${HOST_USER_ID}" www-data +groupmod -g "${HOST_USER_ID}" www-data + +chgrp -hR www-data /var/www/html +chmod g+rwx /var/www/html/conf + +if [ ! -d /var/documents ]; then + echo "[docker-run] => create volume directory /var/documents ..." + mkdir -p /var/documents +fi +echo "[docker-run] => Set Permission to www-data for /var/documents" +chown -R www-data:www-data /var/documents + +echo "[docker-run] => update '${PHP_INI_DIR}/conf.d/dolibarr-php.ini'" +cat < "${PHP_INI_DIR}/conf.d/dolibarr-php.ini" +date.timezone = ${PHP_INI_DATE_TIMEZONE:-UTC} +memory_limit = ${PHP_INI_MEMORY_LIMIT:-256M} +EOF + +exec apache2-foreground diff --git a/build/docker/mariadb/Dockerfile b/build/docker-dev/mariadb/Dockerfile similarity index 100% rename from build/docker/mariadb/Dockerfile rename to build/docker-dev/mariadb/Dockerfile diff --git a/build/docker/.github/workflows/build.yml b/build/docker/.github/workflows/build.yml new file mode 100644 index 00000000000..c18e0d89e9a --- /dev/null +++ b/build/docker/.github/workflows/build.yml @@ -0,0 +1,36 @@ +name: build +on: + push: + branches: + - master + schedule: + - cron: '0 0 * * 6' + +jobs: + build-docker-images: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: docker/setup-buildx-action@v2 + - env: + DOCKER_BUILD: 1 + DOCKER_PUSH: 1 + run: | + echo ${{ secrets.DOCKER_HUB_PASSWORD }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin + ./update.sh + + update-readme: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: | + docker run --rm -t \ + -v $(pwd):/src \ + -e DOCKER_USER=${{ secrets.DOCKER_HUB_USERNAME }} \ + -e DOCKER_PASS=${{ secrets.DOCKER_HUB_PASSWORD }} \ + -e PUSHRM_PROVIDER=dockerhub \ + -e PUSHRM_FILE=/src/README.md \ + -e PUSHRM_SHORT='Docker image for Dolibarr with auto installer on first boot.' \ + -e PUSHRM_TARGET=docker.io/tuxgasy/dolibarr \ + -e PUSHRM_DEBUG=1 \ + chko/docker-pushrm:1 diff --git a/build/docker/.github/workflows/test.yml b/build/docker/.github/workflows/test.yml new file mode 100644 index 00000000000..483690aa635 --- /dev/null +++ b/build/docker/.github/workflows/test.yml @@ -0,0 +1,27 @@ +name: test +on: + push: + branches: + - master + pull_request: + +jobs: + check-update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: | + ./update.sh + git diff --exit-code + + check-build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - env: + DOLI_INSTALL_AUTO: 0 + run: | + ./update.sh + docker build -t tuxgasy/dolibarr:develop images/develop + docker run -d -p 127.0.0.1:80:80 --name dolibarr tuxgasy/dolibarr:develop + docker ps | grep -q dolibarr diff --git a/build/docker/.gitignore b/build/docker/.gitignore new file mode 100644 index 00000000000..90367f68559 --- /dev/null +++ b/build/docker/.gitignore @@ -0,0 +1,3 @@ +.idea/ +.volumes/ +docker-compose-links/ diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile index 5cd4c60673b..e0733d1567e 100644 --- a/build/docker/Dockerfile +++ b/build/docker/Dockerfile @@ -1,61 +1,43 @@ -FROM php:8.1-apache-bullseye +FROM php:8.2-apache-bookworm + +LABEL maintainer="Yann Le Doaré " ENV PHP_INI_DATE_TIMEZONE 'UTC' ENV PHP_INI_MEMORY_LIMIT 256M +ENV PHP_INI_UPLOAD_MAX_FILESIZE 2M +ENV PHP_INI_POST_MAX_SIZE 8M +ENV PHP_INI_ALLOW_URL_FOPEN 0 RUN apt-get update -y \ + && apt-get dist-upgrade -y \ && apt-get install -y --no-install-recommends \ + libc-client-dev \ libfreetype6-dev \ libjpeg62-turbo-dev \ - libjpeg62-turbo \ - libpng-dev \ - libpng16-16 \ + libkrb5-dev \ libldap2-dev \ + libpng-dev \ + libpq-dev \ libxml2-dev \ libzip-dev \ - zlib1g-dev \ - libicu-dev \ - g++ \ default-mysql-client \ - unzip \ - curl \ - apt-utils \ - msmtp \ - msmtp-mta \ - mailutils \ + postgresql-client \ + cron \ && apt-get autoremove -y \ - && rm -rf /var/lib/apt/lists/* \ && docker-php-ext-configure gd --with-freetype --with-jpeg \ && docker-php-ext-install -j$(nproc) calendar intl mysqli pdo_mysql gd soap zip \ - && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ - && docker-php-ext-install -j$(nproc) ldap && \ - mv ${PHP_INI_DIR}/php.ini-development ${PHP_INI_DIR}/php.ini - -RUN mkdir /var/documents -RUN chown www-data:www-data /var/documents - -COPY docker-run.sh /usr/local/bin/ -RUN chmod +x /usr/local/bin/docker-run.sh - -RUN pecl install xdebug && docker-php-ext-enable xdebug -RUN echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so"' >> ${PHP_INI_DIR}/php.ini -RUN echo 'xdebug.mode=debug' >> ${PHP_INI_DIR}/php.ini -RUN echo 'xdebug.start_with_request=yes' >> ${PHP_INI_DIR}/php.ini -RUN echo 'xdebug.client_host=host.docker.internal' >> ${PHP_INI_DIR}/php.ini -RUN echo 'xdebug.client_port=9003' >> ${PHP_INI_DIR}/php.ini -RUN echo 'xdebug.discover_client_host=true' >> ${PHP_INI_DIR}/php.ini -#RUN echo 'xdebug.log="/tmp/xdebug.log"' >> ${PHP_INI_DIR}/php.ini -RUN echo 'xdebug.idekey="netbeans-xdebug"' >> ${PHP_INI_DIR}/php.ini - -# set up sendmail config, to use maildev -RUN echo "account default" > /etc/msmtprc -RUN echo "auth off" >> /etc/msmtprc -RUN echo "port 1025" >> /etc/msmtprc -RUN echo "host mail" >> /etc/msmtprc -RUN echo "from local@localdomain.com" >> /etc/msmtprc -RUN echo "domain localhost.localdomain" >> /etc/msmtprc -RUN echo "sendmail_path=/usr/bin/msmtp -t" >> /usr/local/etc/php/conf.d/php-sendmail.ini + && docker-php-ext-configure pgsql -with-pgsql \ + && docker-php-ext-install pdo_pgsql pgsql \ + && docker-php-ext-configure ldap --with-libdir=lib/$(gcc -dumpmachine)/ \ + && docker-php-ext-install -j$(nproc) ldap \ + && docker-php-ext-configure imap --with-kerberos --with-imap-ssl \ + && docker-php-ext-install imap \ + && mv ${PHP_INI_DIR}/php.ini-production ${PHP_INI_DIR}/php.ini \ + && rm -rf /var/lib/apt/lists/* EXPOSE 80 +COPY docker-run.sh /usr/local/bin/ ENTRYPOINT ["docker-run.sh"] + +CMD ["apache2-foreground"] diff --git a/build/docker/README.md b/build/docker/README.md index 6daf6d6bd5c..7dc8aac3bb0 100644 --- a/build/docker/README.md +++ b/build/docker/README.md @@ -1,34 +1,6 @@ # How to use it ? -The docker-compose.yml file is a sample of a config file to use to build and run Dolibarr in the current workspace with Docker. -This docker image is intended for development usage. -For production usage you should consider other contributor reference like https://hub.docker.com/r/tuxgasy/dolibarr +export HOST_USER_ID=$(id -u) +export MYSQL_ROOT_PWD=$(tr -dc A-Za-z0-9 * Copyright (C) 2016 Florian Henry - * Copyright (C) 2016-2024 Alexandre Spangaro + * Copyright (C) 2016-2024 Alexandre Spangaro * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -252,7 +252,7 @@ if ($type == 'sub') { $help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double'; -llxHeader('', $title_page, $help_url); +llxHeader('', $title_page, $help_url, '', 0, 0, '', '', '', 'mod-accountancy accountancy-consultation page-'.(($type == 'sub') ? 'sub' : '').'balance'); if ($action != 'export_csv') { diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 45bc62aa172..d1b6d6f212b 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -1,10 +1,10 @@ * Copyright (C) 2013-2017 Florian Henry - * Copyright (C) 2013-2024 Alexandre Spangaro + * Copyright (C) 2013-2024 Alexandre Spangaro * Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -352,7 +352,7 @@ $formaccounting = new FormAccounting($db); $title = $langs->trans("CreateMvts"); $help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double'; -llxHeader('', $title, $help_url); +llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-accountancy accountancy-consultation page-card'); // Confirmation to delete the command if ($action == 'delete') { diff --git a/htdocs/accountancy/bookkeeping/export.php b/htdocs/accountancy/bookkeeping/export.php index 4701c0afce0..6b6ba75b901 100644 --- a/htdocs/accountancy/bookkeeping/export.php +++ b/htdocs/accountancy/bookkeeping/export.php @@ -1,12 +1,12 @@ * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2024 Alexandre Spangaro + * Copyright (C) 2013-2024 Alexandre Spangaro * Copyright (C) 2022 Lionel Vessiller * Copyright (C) 2016-2017 Laurent Destailleur * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2022 Progiseize - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -781,7 +781,7 @@ $arrayofselected = is_array($toselect) ? $toselect : array(); // -------------------------------------------------------------------- $help_url = 'EN:Module_Double_Entry_Accounting#Exports|FR:Module_Comptabilité_en_Partie_Double#Exports'; -llxHeader('', $title_page, $help_url); +llxHeader('', $title_page, $help_url, '', 0, 0, '', '', '', 'mod-accountancy accountancy-consultation page-export'); $formconfirm = ''; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 9c6daaed748..80aff0d3267 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1,12 +1,12 @@ * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2024 Alexandre Spangaro + * Copyright (C) 2013-2024 Alexandre Spangaro * Copyright (C) 2022 Lionel Vessiller * Copyright (C) 2016-2017 Laurent Destailleur * Copyright (C) 2018-2021 Frédéric France - * Copyright (C) 2022 Progiseize - * Copyright (C) 2024 MDW + * Copyright (C) 2022 Progiseize + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -734,7 +734,7 @@ $arrayofselected = is_array($toselect) ? $toselect : array(); // Output page // -------------------------------------------------------------------- $help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double'; -llxHeader('', $title_page, $help_url); +llxHeader('', $title_page, $help_url, '', 0, 0, '', '', '', 'mod-accountancy accountancy-consultation page-journal'); $formconfirm = ''; diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index e08bf420eb6..607bc34cb08 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -2,9 +2,9 @@ /* Copyright (C) 2016 Neil Orley * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2020 Florian Henry - * Copyright (C) 2013-2024 Alexandre Spangaro + * Copyright (C) 2013-2024 Alexandre Spangaro * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -561,7 +561,7 @@ if ($type == 'sub') { } $title_page .= ')'; $help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double'; -llxHeader('', $title_page, $help_url); +llxHeader('', $title_page, $help_url, '', 0, 0, '', '', '', 'mod-accountancy accountancy-consultation page-'.(($type == 'sub') ? 'sub' : '').'ledger'); // List $nbtotalofrecords = ''; diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index 627693bfc3a..f606cc48868 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -86,7 +86,7 @@ if ($action == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) { */ $help_url ='EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Liaisons_comptables'; -llxHeader("", $langs->trans('FicheVentilation'), $help_url); +llxHeader("", $langs->trans('FicheVentilation'), $help_url, '', 0, 0, '', '', '', 'mod-accountancy accountancy-customer page-card'); if ($cancel == $langs->trans("Cancel")) { $action = ''; diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 6b26b6ae43f..59e31753f39 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -301,7 +301,7 @@ if ($action == 'validatehistory') { */ $help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Liaisons_comptables'; -llxHeader('', $langs->trans("CustomersVentilation"), $help_url); +llxHeader('', $langs->trans("CustomersVentilation"), $help_url, '', 0, 0, '', '', '', 'mod-accountancy accountancy-customer page-index'); $textprevyear = ''.img_previous().''; $textnextyear = ' '.img_next().''; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 618e6392a90..6d8dd13951f 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -177,7 +177,7 @@ $formother = new FormOther($db); $help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Liaisons_comptables'; -llxHeader('', $langs->trans("CustomersVentilation").' - '.$langs->trans("Dispatched"), $help_url); +llxHeader('', $langs->trans("CustomersVentilation").' - '.$langs->trans("Dispatched"), $help_url, '', 0, 0, '', '', '', 'mod-accountancy accountancy-customer page-lines'); print '