Skip to content

Commit

Permalink
Updated images and README
Browse files Browse the repository at this point in the history
  • Loading branch information
fcharlaix-opendsi committed Sep 12, 2024
1 parent 744f232 commit b3a612a
Show file tree
Hide file tree
Showing 39 changed files with 3,658 additions and 706 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ Dolibarr is a modern software package to manage your organization's activity (co

## Supported tags

* 15.0.3-php7.4 15.0.3 15
* 16.0.5-php8.1 16.0.5 16
* 17.0.4-php8.1 17.0.4 17
* 18.0.5-php8.1 18.0.5 18
* 19.0.3-php8.2 19.0.3 19 latest
* develop
* 15.0.3-php7.4 15.0.3-php7.4-fpm 15.0.3 15 15.0.3-fpm 15-fpm
* 16.0.5-php8.1 16.0.5-php8.1-fpm 16.0.5 16 16.0.5-fpm 16-fpm
* 17.0.4-php8.1 17.0.4-php8.1-fpm 17.0.4 17 17.0.4-fpm 17-fpm
* 18.0.5-php8.1 18.0.5-php8.1-fpm 18.0.5 18 18.0.5-fpm 18-fpm
* 19.0.3-php8.2 19.0.3-php8.2-fpm 19.0.3 19 19.0.3-fpm 19-fpm latest latest-fpm
* develop develop-fpm

**End of support for PHP < 7.4**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ ENV PHP_INI_UPLOAD_MAX_FILESIZE 2M
ENV PHP_INI_POST_MAX_SIZE 8M
ENV PHP_INI_ALLOW_URL_FOPEN 0

RUN sed -i \
-e 's/^\(ServerSignature On\)$/#\1/g' \
-e 's/^#\(ServerSignature Off\)$/\1/g' \
-e 's/^\(ServerTokens\) OS$/\1 Prod/g' \
/etc/apache2/conf-available/security.conf
RUN sed -i -e 's/^\(ServerSignature On\)$/#\1/g' -e 's/^#\(ServerSignature Off\)$/\1/g' -e 's/^\(ServerTokens\) OS$/\1 Prod/g' /etc/apache2/conf-available/security.conf

RUN apt-get update -y \
&& apt-get dist-upgrade -y \
Expand All @@ -61,6 +57,7 @@ RUN apt-get update -y \
default-mysql-client \
postgresql-client \
cron \
rsync \
&& apt-get autoremove -y \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) calendar intl mysqli pdo_mysql gd soap zip \
Expand All @@ -76,7 +73,8 @@ RUN apt-get update -y \
# Get Dolibarr
RUN curl -fLSs https://github.com/Dolibarr/dolibarr/archive/${DOLI_VERSION}.tar.gz |\
tar -C /tmp -xz && \
cp -r /tmp/dolibarr-${DOLI_VERSION}/htdocs/* /var/www/html/ && \
mkdir -p /usr/src/dolibarr && \
cp -r /tmp/dolibarr-${DOLI_VERSION}/htdocs/* /usr/src/dolibarr/ && \
ln -s /var/www/html /var/www/htdocs && \
cp -r /tmp/dolibarr-${DOLI_VERSION}/scripts /var/www/ && \
rm -rf /tmp/* && \
Expand All @@ -86,6 +84,7 @@ RUN curl -fLSs https://github.com/Dolibarr/dolibarr/archive/${DOLI_VERSION}.tar.

EXPOSE 80
VOLUME /var/www/documents
VOLUME /var/www/html
VOLUME /var/www/html/custom

COPY docker-init.php /var/www/scripts/
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ EOF

if [[ ! -f /var/www/html/conf/conf.php ]]; then
echo "[INIT] => update Dolibarr Config ..."
mkdir /var/www/html/conf
cat > /var/www/html/conf/conf.php << EOF
<?php
\$dolibarr_main_url_root='${DOLI_URL_ROOT}';
Expand Down Expand Up @@ -155,6 +156,13 @@ function runScripts()
fi
}

# Function called to update the htdocs folde with the new code
function updateHtdocs()
{
echo "Updating htdocs folder..."
rsync -rlD --chown www-data:www-data --delete --exclude custom --exclude conf/conf.php /usr/src/dolibarr/ /var/www/html/
}

# Function called to initialize the database (creation of tables and init data)
function initializeDatabase()
{
Expand Down Expand Up @@ -202,7 +210,7 @@ function initializeDatabase()

if [[ ${DOLI_INIT_DEMO} -eq 1 ]]; then
mkdir -p /var/www/dev/initdemo/
> /var/www/documents/vi
> /var/www/documents/vi
versiondemo=`echo "${DOLI_VERSION}" | sed "s/^\([0-9]*\.[0-9]*\).*/\1.0/"`
echo "Get demo data from file https://raw.githubusercontent.com/Dolibarr/dolibarr/${DOLI_VERSION}/dev/initdemo/mysqldump_dolibarr_$versiondemo.sql ..."
curl -fLSs -o /var/www/dev/initdemo/initdemo.sql https://raw.githubusercontent.com/Dolibarr/dolibarr/${DOLI_VERSION}/dev/initdemo/mysqldump_dolibarr_$versiondemo.sql
Expand Down Expand Up @@ -281,11 +289,13 @@ function run()
mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "SELECT Q.LAST_INSTALLED_VERSION FROM (SELECT INET_ATON(CONCAT(value, REPEAT('.0', 3 - CHAR_LENGTH(value) + CHAR_LENGTH(REPLACE(value, '.', ''))))) as VERSION_ATON, value as LAST_INSTALLED_VERSION FROM llx_const WHERE name IN ('MAIN_VERSION_LAST_INSTALL', 'MAIN_VERSION_LAST_UPGRADE') and entity=0) Q ORDER BY VERSION_ATON DESC LIMIT 1" > /tmp/lastinstall.result 2>&1
r=$?
if [[ ${r} -ne 0 ]]; then
updateHtdocs
initializeDatabase
else
INSTALLED_VERSION=`grep -v LAST_INSTALLED_VERSION /tmp/lastinstall.result`
echo "Last installed Version is : ${INSTALLED_VERSION}"
if [[ "$(echo ${INSTALLED_VERSION} | cut -d. -f1)" -lt "$(echo ${DOLI_VERSION} | cut -d. -f1)" ]]; then
updateHtdocs
migrateDatabase
else
echo "Schema update is not required ... Enjoy !!"
Expand Down
94 changes: 94 additions & 0 deletions images/15.0.3/fpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
ARG ARCH=

# Use an image like PHP_BASE_IMAGE=x.y-apache-buster
FROM ${ARCH}php:7.4-fpm

LABEL maintainer="Garcia MICHEL <[email protected]>"

ENV DOLI_VERSION 15.0.3
ENV DOLI_INSTALL_AUTO 1
ENV DOLI_PROD 1

ENV DOLI_DB_TYPE mysqli
ENV DOLI_DB_HOST mysql
ENV DOLI_DB_HOST_PORT 3306
ENV DOLI_DB_NAME dolidb

ENV DOLI_URL_ROOT 'http://localhost'
ENV DOLI_NOCSRFCHECK 0

ENV DOLI_AUTH dolibarr
ENV DOLI_LDAP_HOST 127.0.0.1
ENV DOLI_LDAP_PORT 389
ENV DOLI_LDAP_VERSION 3
ENV DOLI_LDAP_SERVER_TYPE openldap
ENV DOLI_LDAP_LOGIN_ATTRIBUTE uid
ENV DOLI_LDAP_DN 'ou=users,dc=my-domain,dc=com'
ENV DOLI_LDAP_FILTER ''
ENV DOLI_LDAP_BIND_DN ''
ENV DOLI_LDAP_BIND_PASS ''
ENV DOLI_LDAP_DEBUG false

ENV DOLI_CRON 0

ENV WWW_USER_ID 33
ENV WWW_GROUP_ID 33

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 \
libkrb5-dev \
libldap2-dev \
libpng-dev \
libpq-dev \
libxml2-dev \
libzip-dev \
default-mysql-client \
postgresql-client \
cron \
rsync \
&& apt-get autoremove -y \
&& 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 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/*

# Get Dolibarr
RUN curl -fLSs https://github.com/Dolibarr/dolibarr/archive/${DOLI_VERSION}.tar.gz |\
tar -C /tmp -xz && \
mkdir -p /usr/src/dolibarr && \
cp -r /tmp/dolibarr-${DOLI_VERSION}/htdocs/* /usr/src/dolibarr/ && \
ln -s /var/www/html /var/www/htdocs && \
cp -r /tmp/dolibarr-${DOLI_VERSION}/scripts /var/www/ && \
rm -rf /tmp/* && \
mkdir -p /var/www/documents && \
mkdir -p /var/www/html/custom && \
chown -R www-data:www-data /var/www

EXPOSE 9000
VOLUME /var/www/documents
VOLUME /var/www/html
VOLUME /var/www/html/custom

COPY docker-init.php /var/www/scripts/
COPY docker-run.sh /usr/local/bin/
ENTRYPOINT ["docker-run.sh"]

CMD ["php-fpm"]
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ EOF

if [[ ! -f /var/www/html/conf/conf.php ]]; then
echo "[INIT] => update Dolibarr Config ..."
mkdir /var/www/html/conf
cat > /var/www/html/conf/conf.php << EOF
<?php
\$dolibarr_main_url_root='${DOLI_URL_ROOT}';
Expand Down Expand Up @@ -155,6 +156,13 @@ function runScripts()
fi
}

# Function called to update the htdocs folde with the new code
function updateHtdocs()
{
echo "Updating htdocs folder..."
rsync -rlD --chown www-data:www-data --delete --exclude custom --exclude conf/conf.php /usr/src/dolibarr/ /var/www/html/
}

# Function called to initialize the database (creation of tables and init data)
function initializeDatabase()
{
Expand Down Expand Up @@ -202,7 +210,7 @@ function initializeDatabase()

if [[ ${DOLI_INIT_DEMO} -eq 1 ]]; then
mkdir -p /var/www/dev/initdemo/
> /var/www/documents/vi
> /var/www/documents/vi
versiondemo=`echo "${DOLI_VERSION}" | sed "s/^\([0-9]*\.[0-9]*\).*/\1.0/"`
echo "Get demo data from file https://raw.githubusercontent.com/Dolibarr/dolibarr/${DOLI_VERSION}/dev/initdemo/mysqldump_dolibarr_$versiondemo.sql ..."
curl -fLSs -o /var/www/dev/initdemo/initdemo.sql https://raw.githubusercontent.com/Dolibarr/dolibarr/${DOLI_VERSION}/dev/initdemo/mysqldump_dolibarr_$versiondemo.sql
Expand Down Expand Up @@ -281,11 +289,13 @@ function run()
mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "SELECT Q.LAST_INSTALLED_VERSION FROM (SELECT INET_ATON(CONCAT(value, REPEAT('.0', 3 - CHAR_LENGTH(value) + CHAR_LENGTH(REPLACE(value, '.', ''))))) as VERSION_ATON, value as LAST_INSTALLED_VERSION FROM llx_const WHERE name IN ('MAIN_VERSION_LAST_INSTALL', 'MAIN_VERSION_LAST_UPGRADE') and entity=0) Q ORDER BY VERSION_ATON DESC LIMIT 1" > /tmp/lastinstall.result 2>&1
r=$?
if [[ ${r} -ne 0 ]]; then
updateHtdocs
initializeDatabase
else
INSTALLED_VERSION=`grep -v LAST_INSTALLED_VERSION /tmp/lastinstall.result`
echo "Last installed Version is : ${INSTALLED_VERSION}"
if [[ "$(echo ${INSTALLED_VERSION} | cut -d. -f1)" -lt "$(echo ${DOLI_VERSION} | cut -d. -f1)" ]]; then
updateHtdocs
migrateDatabase
else
echo "Schema update is not required ... Enjoy !!"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ ENV PHP_INI_UPLOAD_MAX_FILESIZE 2M
ENV PHP_INI_POST_MAX_SIZE 8M
ENV PHP_INI_ALLOW_URL_FOPEN 0

RUN sed -i \
-e 's/^\(ServerSignature On\)$/#\1/g' \
-e 's/^#\(ServerSignature Off\)$/\1/g' \
-e 's/^\(ServerTokens\) OS$/\1 Prod/g' \
/etc/apache2/conf-available/security.conf
RUN sed -i -e 's/^\(ServerSignature On\)$/#\1/g' -e 's/^#\(ServerSignature Off\)$/\1/g' -e 's/^\(ServerTokens\) OS$/\1 Prod/g' /etc/apache2/conf-available/security.conf

RUN apt-get update -y \
&& apt-get dist-upgrade -y \
Expand All @@ -61,6 +57,7 @@ RUN apt-get update -y \
default-mysql-client \
postgresql-client \
cron \
rsync \
&& apt-get autoremove -y \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) calendar intl mysqli pdo_mysql gd soap zip \
Expand All @@ -76,7 +73,8 @@ RUN apt-get update -y \
# Get Dolibarr
RUN curl -fLSs https://github.com/Dolibarr/dolibarr/archive/${DOLI_VERSION}.tar.gz |\
tar -C /tmp -xz && \
cp -r /tmp/dolibarr-${DOLI_VERSION}/htdocs/* /var/www/html/ && \
mkdir -p /usr/src/dolibarr && \
cp -r /tmp/dolibarr-${DOLI_VERSION}/htdocs/* /usr/src/dolibarr/ && \
ln -s /var/www/html /var/www/htdocs && \
cp -r /tmp/dolibarr-${DOLI_VERSION}/scripts /var/www/ && \
rm -rf /tmp/* && \
Expand All @@ -86,6 +84,7 @@ RUN curl -fLSs https://github.com/Dolibarr/dolibarr/archive/${DOLI_VERSION}.tar.

EXPOSE 80
VOLUME /var/www/documents
VOLUME /var/www/html
VOLUME /var/www/html/custom

COPY docker-init.php /var/www/scripts/
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ EOF

if [[ ! -f /var/www/html/conf/conf.php ]]; then
echo "[INIT] => update Dolibarr Config ..."
mkdir /var/www/html/conf
cat > /var/www/html/conf/conf.php << EOF
<?php
\$dolibarr_main_url_root='${DOLI_URL_ROOT}';
Expand Down Expand Up @@ -155,6 +156,13 @@ function runScripts()
fi
}

# Function called to update the htdocs folde with the new code
function updateHtdocs()
{
echo "Updating htdocs folder..."
rsync -rlD --chown www-data:www-data --delete --exclude custom --exclude conf/conf.php /usr/src/dolibarr/ /var/www/html/
}

# Function called to initialize the database (creation of tables and init data)
function initializeDatabase()
{
Expand Down Expand Up @@ -202,7 +210,7 @@ function initializeDatabase()

if [[ ${DOLI_INIT_DEMO} -eq 1 ]]; then
mkdir -p /var/www/dev/initdemo/
> /var/www/documents/vi
> /var/www/documents/vi
versiondemo=`echo "${DOLI_VERSION}" | sed "s/^\([0-9]*\.[0-9]*\).*/\1.0/"`
echo "Get demo data from file https://raw.githubusercontent.com/Dolibarr/dolibarr/${DOLI_VERSION}/dev/initdemo/mysqldump_dolibarr_$versiondemo.sql ..."
curl -fLSs -o /var/www/dev/initdemo/initdemo.sql https://raw.githubusercontent.com/Dolibarr/dolibarr/${DOLI_VERSION}/dev/initdemo/mysqldump_dolibarr_$versiondemo.sql
Expand Down Expand Up @@ -281,11 +289,13 @@ function run()
mysql -u ${DOLI_DB_USER} -p${DOLI_DB_PASSWORD} -h ${DOLI_DB_HOST} -P ${DOLI_DB_HOST_PORT} ${DOLI_DB_NAME} -e "SELECT Q.LAST_INSTALLED_VERSION FROM (SELECT INET_ATON(CONCAT(value, REPEAT('.0', 3 - CHAR_LENGTH(value) + CHAR_LENGTH(REPLACE(value, '.', ''))))) as VERSION_ATON, value as LAST_INSTALLED_VERSION FROM llx_const WHERE name IN ('MAIN_VERSION_LAST_INSTALL', 'MAIN_VERSION_LAST_UPGRADE') and entity=0) Q ORDER BY VERSION_ATON DESC LIMIT 1" > /tmp/lastinstall.result 2>&1
r=$?
if [[ ${r} -ne 0 ]]; then
updateHtdocs
initializeDatabase
else
INSTALLED_VERSION=`grep -v LAST_INSTALLED_VERSION /tmp/lastinstall.result`
echo "Last installed Version is : ${INSTALLED_VERSION}"
if [[ "$(echo ${INSTALLED_VERSION} | cut -d. -f1)" -lt "$(echo ${DOLI_VERSION} | cut -d. -f1)" ]]; then
updateHtdocs
migrateDatabase
else
echo "Schema update is not required ... Enjoy !!"
Expand Down
Loading

0 comments on commit b3a612a

Please sign in to comment.