diff --git a/Dockerfile.template b/Dockerfile.template index 9782c0a..a37e0d3 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -3,9 +3,12 @@ ARG ARCH= # Use an image like PHP_BASE_IMAGE=x.y-apache-buster FROM ${ARCH}php:%PHP_BASE_IMAGE% -LABEL maintainer="Garcia MICHEL " +# Credit/Initial maintainer: Garcia MICHEL +#LABEL maintainer="Garcia MICHEL " +LABEL maintainer="The Dolibarr foundation " ENV DOLI_VERSION %DOLI_VERSION% +ENV DOLI_VERSION_FOR_INIT_DEMO %DOLI_VERSION_FOR_INIT_DEMO% ENV DOLI_INSTALL_AUTO 1 ENV DOLI_PROD 1 diff --git a/docker-run.sh b/docker-run.sh index 40bdad0..96b6b45 100755 --- a/docker-run.sh +++ b/docker-run.sh @@ -210,12 +210,16 @@ function initializeDatabase() mkdir -p /var/www/dev/initdemo/ echo "DOLI_VERSION=$DOLI_VERSION" - # Convert version x.y into x.y.0 + + # Set DOLI_VERSION to a number "x.y", even if value is "develop" if [ ${DOLI_VERSION} == "develop" ]; then - echo "DOLI_VERSION is develop, we will use the file for version %DOLIBARR_VERSION_FOR_INIT_DEMO%" - DOLI_VERSION="%DOLIBARR_VERSION_FOR_INIT_DEMO%" + echo "DOLI_VERSION is develop, we will use the github source files for version $DOLI_VERSION_FOR_INIT_DEMO" + DOLI_VERSION="$DOLI_VERSION_FOR_INIT_DEMO" fi - versiondemo=`echo "${DOLI_VERSION}" | sed "s/^\([0-9]*\.[0-9]*\).*/\1.0/"` # Convert vesion x.y into x.y.0 + + # Convert version x.y.z into x.y.0 + versiondemo=`echo "${DOLI_VERSION}" | sed "s/^\([0-9]*\.[0-9]*\).*/\1.0/"` # Convert vesion x.y.z into x.y.0 + echo "Get demo data with: curl -fLSs -o /var/www/dev/initdemo/initdemo.sql 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 if [ $? -ne 0 ]; then diff --git a/images/15.0.3-php7.4/Dockerfile b/images/15.0.3-php7.4/Dockerfile index 578c298..c35815c 100644 --- a/images/15.0.3-php7.4/Dockerfile +++ b/images/15.0.3-php7.4/Dockerfile @@ -6,6 +6,7 @@ FROM ${ARCH}php:7.4-apache-buster LABEL maintainer="Garcia MICHEL " ENV DOLI_VERSION 15.0.3 +ENV DOLI_VERSION_FOR_INIT_DEMO 15.0 ENV DOLI_INSTALL_AUTO 1 ENV DOLI_PROD 1 diff --git a/images/15.0.3-php7.4/docker-run.sh b/images/15.0.3-php7.4/docker-run.sh index 40bdad0..96b6b45 100755 --- a/images/15.0.3-php7.4/docker-run.sh +++ b/images/15.0.3-php7.4/docker-run.sh @@ -210,12 +210,16 @@ function initializeDatabase() mkdir -p /var/www/dev/initdemo/ echo "DOLI_VERSION=$DOLI_VERSION" - # Convert version x.y into x.y.0 + + # Set DOLI_VERSION to a number "x.y", even if value is "develop" if [ ${DOLI_VERSION} == "develop" ]; then - echo "DOLI_VERSION is develop, we will use the file for version %DOLIBARR_VERSION_FOR_INIT_DEMO%" - DOLI_VERSION="%DOLIBARR_VERSION_FOR_INIT_DEMO%" + echo "DOLI_VERSION is develop, we will use the github source files for version $DOLI_VERSION_FOR_INIT_DEMO" + DOLI_VERSION="$DOLI_VERSION_FOR_INIT_DEMO" fi - versiondemo=`echo "${DOLI_VERSION}" | sed "s/^\([0-9]*\.[0-9]*\).*/\1.0/"` # Convert vesion x.y into x.y.0 + + # Convert version x.y.z into x.y.0 + versiondemo=`echo "${DOLI_VERSION}" | sed "s/^\([0-9]*\.[0-9]*\).*/\1.0/"` # Convert vesion x.y.z into x.y.0 + echo "Get demo data with: curl -fLSs -o /var/www/dev/initdemo/initdemo.sql 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 if [ $? -ne 0 ]; then diff --git a/images/16.0.5-php8.1/Dockerfile b/images/16.0.5-php8.1/Dockerfile index cd499d0..c99ff93 100644 --- a/images/16.0.5-php8.1/Dockerfile +++ b/images/16.0.5-php8.1/Dockerfile @@ -6,6 +6,7 @@ FROM ${ARCH}php:8.1-apache-buster LABEL maintainer="Garcia MICHEL " ENV DOLI_VERSION 16.0.5 +ENV DOLI_VERSION_FOR_INIT_DEMO 16.0 ENV DOLI_INSTALL_AUTO 1 ENV DOLI_PROD 1 diff --git a/images/16.0.5-php8.1/docker-run.sh b/images/16.0.5-php8.1/docker-run.sh index 40bdad0..96b6b45 100755 --- a/images/16.0.5-php8.1/docker-run.sh +++ b/images/16.0.5-php8.1/docker-run.sh @@ -210,12 +210,16 @@ function initializeDatabase() mkdir -p /var/www/dev/initdemo/ echo "DOLI_VERSION=$DOLI_VERSION" - # Convert version x.y into x.y.0 + + # Set DOLI_VERSION to a number "x.y", even if value is "develop" if [ ${DOLI_VERSION} == "develop" ]; then - echo "DOLI_VERSION is develop, we will use the file for version %DOLIBARR_VERSION_FOR_INIT_DEMO%" - DOLI_VERSION="%DOLIBARR_VERSION_FOR_INIT_DEMO%" + echo "DOLI_VERSION is develop, we will use the github source files for version $DOLI_VERSION_FOR_INIT_DEMO" + DOLI_VERSION="$DOLI_VERSION_FOR_INIT_DEMO" fi - versiondemo=`echo "${DOLI_VERSION}" | sed "s/^\([0-9]*\.[0-9]*\).*/\1.0/"` # Convert vesion x.y into x.y.0 + + # Convert version x.y.z into x.y.0 + versiondemo=`echo "${DOLI_VERSION}" | sed "s/^\([0-9]*\.[0-9]*\).*/\1.0/"` # Convert vesion x.y.z into x.y.0 + echo "Get demo data with: curl -fLSs -o /var/www/dev/initdemo/initdemo.sql 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 if [ $? -ne 0 ]; then diff --git a/images/17.0.4-php8.1/Dockerfile b/images/17.0.4-php8.1/Dockerfile index 40b3a72..6b89007 100644 --- a/images/17.0.4-php8.1/Dockerfile +++ b/images/17.0.4-php8.1/Dockerfile @@ -6,6 +6,7 @@ FROM ${ARCH}php:8.1-apache-buster LABEL maintainer="Garcia MICHEL " ENV DOLI_VERSION 17.0.4 +ENV DOLI_VERSION_FOR_INIT_DEMO 17.0 ENV DOLI_INSTALL_AUTO 1 ENV DOLI_PROD 1 diff --git a/images/17.0.4-php8.1/docker-run.sh b/images/17.0.4-php8.1/docker-run.sh index 40bdad0..96b6b45 100755 --- a/images/17.0.4-php8.1/docker-run.sh +++ b/images/17.0.4-php8.1/docker-run.sh @@ -210,12 +210,16 @@ function initializeDatabase() mkdir -p /var/www/dev/initdemo/ echo "DOLI_VERSION=$DOLI_VERSION" - # Convert version x.y into x.y.0 + + # Set DOLI_VERSION to a number "x.y", even if value is "develop" if [ ${DOLI_VERSION} == "develop" ]; then - echo "DOLI_VERSION is develop, we will use the file for version %DOLIBARR_VERSION_FOR_INIT_DEMO%" - DOLI_VERSION="%DOLIBARR_VERSION_FOR_INIT_DEMO%" + echo "DOLI_VERSION is develop, we will use the github source files for version $DOLI_VERSION_FOR_INIT_DEMO" + DOLI_VERSION="$DOLI_VERSION_FOR_INIT_DEMO" fi - versiondemo=`echo "${DOLI_VERSION}" | sed "s/^\([0-9]*\.[0-9]*\).*/\1.0/"` # Convert vesion x.y into x.y.0 + + # Convert version x.y.z into x.y.0 + versiondemo=`echo "${DOLI_VERSION}" | sed "s/^\([0-9]*\.[0-9]*\).*/\1.0/"` # Convert vesion x.y.z into x.y.0 + echo "Get demo data with: curl -fLSs -o /var/www/dev/initdemo/initdemo.sql 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 if [ $? -ne 0 ]; then diff --git a/images/18.0.5-php8.1/Dockerfile b/images/18.0.5-php8.1/Dockerfile index 0294c4e..ea2d46c 100644 --- a/images/18.0.5-php8.1/Dockerfile +++ b/images/18.0.5-php8.1/Dockerfile @@ -6,6 +6,7 @@ FROM ${ARCH}php:8.1-apache-buster LABEL maintainer="Garcia MICHEL " ENV DOLI_VERSION 18.0.5 +ENV DOLI_VERSION_FOR_INIT_DEMO 18.0 ENV DOLI_INSTALL_AUTO 1 ENV DOLI_PROD 1 diff --git a/images/18.0.5-php8.1/docker-run.sh b/images/18.0.5-php8.1/docker-run.sh index 40bdad0..96b6b45 100755 --- a/images/18.0.5-php8.1/docker-run.sh +++ b/images/18.0.5-php8.1/docker-run.sh @@ -210,12 +210,16 @@ function initializeDatabase() mkdir -p /var/www/dev/initdemo/ echo "DOLI_VERSION=$DOLI_VERSION" - # Convert version x.y into x.y.0 + + # Set DOLI_VERSION to a number "x.y", even if value is "develop" if [ ${DOLI_VERSION} == "develop" ]; then - echo "DOLI_VERSION is develop, we will use the file for version %DOLIBARR_VERSION_FOR_INIT_DEMO%" - DOLI_VERSION="%DOLIBARR_VERSION_FOR_INIT_DEMO%" + echo "DOLI_VERSION is develop, we will use the github source files for version $DOLI_VERSION_FOR_INIT_DEMO" + DOLI_VERSION="$DOLI_VERSION_FOR_INIT_DEMO" fi - versiondemo=`echo "${DOLI_VERSION}" | sed "s/^\([0-9]*\.[0-9]*\).*/\1.0/"` # Convert vesion x.y into x.y.0 + + # Convert version x.y.z into x.y.0 + versiondemo=`echo "${DOLI_VERSION}" | sed "s/^\([0-9]*\.[0-9]*\).*/\1.0/"` # Convert vesion x.y.z into x.y.0 + echo "Get demo data with: curl -fLSs -o /var/www/dev/initdemo/initdemo.sql 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 if [ $? -ne 0 ]; then diff --git a/images/19.0.3-php8.2/Dockerfile b/images/19.0.3-php8.2/Dockerfile index 120cea6..c30b070 100644 --- a/images/19.0.3-php8.2/Dockerfile +++ b/images/19.0.3-php8.2/Dockerfile @@ -6,6 +6,7 @@ FROM ${ARCH}php:8.2-apache-buster LABEL maintainer="Garcia MICHEL " ENV DOLI_VERSION 19.0.3 +ENV DOLI_VERSION_FOR_INIT_DEMO 19.0 ENV DOLI_INSTALL_AUTO 1 ENV DOLI_PROD 1 diff --git a/images/19.0.3-php8.2/docker-run.sh b/images/19.0.3-php8.2/docker-run.sh index 40bdad0..96b6b45 100755 --- a/images/19.0.3-php8.2/docker-run.sh +++ b/images/19.0.3-php8.2/docker-run.sh @@ -210,12 +210,16 @@ function initializeDatabase() mkdir -p /var/www/dev/initdemo/ echo "DOLI_VERSION=$DOLI_VERSION" - # Convert version x.y into x.y.0 + + # Set DOLI_VERSION to a number "x.y", even if value is "develop" if [ ${DOLI_VERSION} == "develop" ]; then - echo "DOLI_VERSION is develop, we will use the file for version %DOLIBARR_VERSION_FOR_INIT_DEMO%" - DOLI_VERSION="%DOLIBARR_VERSION_FOR_INIT_DEMO%" + echo "DOLI_VERSION is develop, we will use the github source files for version $DOLI_VERSION_FOR_INIT_DEMO" + DOLI_VERSION="$DOLI_VERSION_FOR_INIT_DEMO" fi - versiondemo=`echo "${DOLI_VERSION}" | sed "s/^\([0-9]*\.[0-9]*\).*/\1.0/"` # Convert vesion x.y into x.y.0 + + # Convert version x.y.z into x.y.0 + versiondemo=`echo "${DOLI_VERSION}" | sed "s/^\([0-9]*\.[0-9]*\).*/\1.0/"` # Convert vesion x.y.z into x.y.0 + echo "Get demo data with: curl -fLSs -o /var/www/dev/initdemo/initdemo.sql 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 if [ $? -ne 0 ]; then diff --git a/images/develop/Dockerfile b/images/develop/Dockerfile index 31c8f04..1098d18 100644 --- a/images/develop/Dockerfile +++ b/images/develop/Dockerfile @@ -6,6 +6,7 @@ FROM ${ARCH}php:8.2-apache-buster LABEL maintainer="Garcia MICHEL " ENV DOLI_VERSION develop +ENV DOLI_VERSION_FOR_INIT_DEMO develop ENV DOLI_INSTALL_AUTO 1 ENV DOLI_PROD 1 diff --git a/images/develop/docker-run.sh b/images/develop/docker-run.sh index 40bdad0..96b6b45 100755 --- a/images/develop/docker-run.sh +++ b/images/develop/docker-run.sh @@ -210,12 +210,16 @@ function initializeDatabase() mkdir -p /var/www/dev/initdemo/ echo "DOLI_VERSION=$DOLI_VERSION" - # Convert version x.y into x.y.0 + + # Set DOLI_VERSION to a number "x.y", even if value is "develop" if [ ${DOLI_VERSION} == "develop" ]; then - echo "DOLI_VERSION is develop, we will use the file for version %DOLIBARR_VERSION_FOR_INIT_DEMO%" - DOLI_VERSION="%DOLIBARR_VERSION_FOR_INIT_DEMO%" + echo "DOLI_VERSION is develop, we will use the github source files for version $DOLI_VERSION_FOR_INIT_DEMO" + DOLI_VERSION="$DOLI_VERSION_FOR_INIT_DEMO" fi - versiondemo=`echo "${DOLI_VERSION}" | sed "s/^\([0-9]*\.[0-9]*\).*/\1.0/"` # Convert vesion x.y into x.y.0 + + # Convert version x.y.z into x.y.0 + versiondemo=`echo "${DOLI_VERSION}" | sed "s/^\([0-9]*\.[0-9]*\).*/\1.0/"` # Convert vesion x.y.z into x.y.0 + echo "Get demo data with: curl -fLSs -o /var/www/dev/initdemo/initdemo.sql 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 if [ $? -ne 0 ]; then diff --git a/test.sh b/test.sh index e85bda2..9b0f2ce 100755 --- a/test.sh +++ b/test.sh @@ -47,14 +47,14 @@ if [ "${PHP_VER}" = "" ]; then echo " - PHP most recent" echo "Building image ..." echo "DOLI_VERSION=${DOLI_VER} PHP_VERSION='' $dockerComposeBin -f '${BASE_DIR}/docker-compose.yml' [down|...]" - DOLI_VERSION=${DOLI_VER} PHP_VERSION="" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" down 1>/dev/null 2>/dev/null + DOLI_VERSION=${DOLI_VER} PHP_VERSION="" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" down 1>/dev/null DOLI_VERSION=${DOLI_VER} PHP_VERSION="" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" build web DOLI_VERSION=${DOLI_VER} PHP_VERSION="" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" up --force-recreate web cron DOLI_VERSION=${DOLI_VER} PHP_VERSION="" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" down else echo " - PHP ${PHP_VER}" echo "Building image ..." - DOLI_VERSION=${DOLI_VER} PHP_VERSION="-php${PHP_VER}" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" down 1> /dev/null + DOLI_VERSION=${DOLI_VER} PHP_VERSION="-php${PHP_VER}" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" down 1>/dev/null DOLI_VERSION=${DOLI_VER} PHP_VERSION="-php${PHP_VER}" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" build web DOLI_VERSION=${DOLI_VER} PHP_VERSION="-php${PHP_VER}" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" up --force-recreate web cron DOLI_VERSION=${DOLI_VER} PHP_VERSION="-php${PHP_VER}" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" down diff --git a/update.sh b/update.sh index f227caf..bf78da8 100755 --- a/update.sh +++ b/update.sh @@ -33,7 +33,7 @@ for dolibarrVersion in "${DOLIBARR_VERSIONS[@]}"; do tags="${tags}\n\*" dolibarrMajor=$(echo ${dolibarrVersion} | cut -d. -f1) - # Mapping version according https://wiki.dolibarr.org/index.php/Versions + # Mapping PHP version according Dolibarr version (See https://wiki.dolibarr.org/index.php/Versions) # Regarding PHP Supported version : https://www.php.net/supported-versions.php if [ "${dolibarrVersion}" = "develop" ] || [ "${dolibarrMajor}" -ge "19" ] || [ "${dolibarrMajor}" -ge "20" ]; then php_base_images=( "8.2-apache-buster" ) @@ -63,10 +63,15 @@ for dolibarrVersion in "${DOLIBARR_VERSIONS[@]}"; do dir="${BASE_DIR}/images/${currentTag}" + # Set DOLIBARR_VERSION_FOR_INIT_DEMO to x.y version + if [ ${dolibarrVersion} != "dolibarr" ]; then + DOLIBARR_VERSION_FOR_INIT_DEMO=$(echo "${dolibarrVersion}" | sed 's/\(\.[^\.]*\)\.[^\.]*$/\1/') + fi + mkdir -p "${dir}" sed 's/%PHP_BASE_IMAGE%/'"${php_base_image}"'/;' "${BASE_DIR}/Dockerfile.template" | \ sed 's/%DOLI_VERSION%/'"${dolibarrVersion}"'/;' | \ - sed 's/%DOLIBARR_VERSION_FOR_INIT_DEMO%/'"${DOLIBARR_VERSION_FOR_INIT_DEMO}"'/;' \ + sed 's/%DOLI_VERSION_FOR_INIT_DEMO%/'"${DOLIBARR_VERSION_FOR_INIT_DEMO}"'/;' \ > "${dir}/Dockerfile" cp -a "${BASE_DIR}/docker-init.php" "${dir}/docker-init.php" diff --git a/versions.sh b/versions.sh index 09edb0c..d895190 100644 --- a/versions.sh +++ b/versions.sh @@ -8,5 +8,6 @@ DOLIBARR_VERSIONS=("15.0.3" "16.0.5" "17.0.4" "18.0.5" "19.0.3" "develop") # The version to use when installing dolibarr/dolibarr:latest DOLIBARR_LATEST_TAG="19.0.3" -# The version to use to find the dump file for init of demo +# The version to use to find the dump file for the init of demo with branch "develop" DOLIBARR_VERSION_FOR_INIT_DEMO="20.0" +