diff --git a/2019.09/apache/entrypoint.sh b/2019.09/apache/entrypoint.sh index 3610ef9..b1d914a 100755 --- a/2019.09/apache/entrypoint.sh +++ b/2019.09/apache/entrypoint.sh @@ -16,62 +16,6 @@ version_greater() { [ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ] } -# checks if the branch and repository exists -check_branch() { - repo=${1:-} - branch=${2:-} - git ls-remote --heads --tags "https://github.com/$repo" | grep -E "refs/(heads|tags)/${branch}$" >/dev/null - [ "$?" -eq "0" ] -} - -# clones the whole develop branch (Friendica and Addons) -clone_develop() { - friendica_git="${FRIENDICA_VERSION}" - addons_git="${FRIENDICA_ADDONS}" - friendica_repo="${FRIENDICA_REPOSITORY:-friendica/friendica}" - friendica_addons_repo="${FRIENDICA_ADDONS_REPO:-friendica/friendica-addons}" - - if echo "{$friendica_git,,}" | grep -Eq '^.*\-dev'; then - friendica_git="develop" - fi - - if echo "{$addons_git,,}" | grep -Eq '^.*\-dev'; then - addons_git="develop" - fi - - # Check if the branches exist before wiping the - if check_branch "$friendica_repo" "$friendica_git" && check_branch "$friendica_addons_repo" "$addons_git" ; then - echo "Downloading Friendica from GitHub '${friendica_repo}/${friendica_git}' ..." - - # Removing the whole directory first - rm -fr /usr/src/friendica - git clone -q -b ${friendica_git} "https://github.com/${friendica_repo}" /usr/src/friendica - - mkdir /usr/src/friendica/addon - git clone -q -b ${addons_git} "https://github.com/${friendica_addons_repo}" /usr/src/friendica/addon - - echo "Download finished" - - if [ ! -f /usr/src/friendica/VERSION ]; then - echo "Couldn't clone repository" - exit 1 - fi - - /usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica - return 0 - - else - if check_branch "$friendica_repo" "$friendica_git"; then - echo "$friendica_repo/$friendica_git is not valid." - else - echo "$friendica_addons_repo/$addons_git is not valid." - fi - echo "Using old version." - return 1 - - fi -} - setup_ssmtp() { if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..." @@ -112,33 +56,18 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then installed_version="$(cat /var/www/html/VERSION)" fi - check=false - # cloning from git is just possible for develop or Release Candidats - if echo "${FRIENDICA_VERSION}" | grep -Eq '^.*(\-dev|-rc|-RC)' || [ "${FRIENDICA_UPGRADE:-false}" = "true" ] || [ ! -f /usr/src/friendica/VERSION ]; then - # just clone & check if it's a new install or upgrade - clone_develop - if [ "$?" -eq "0" ]; then - image_version="$(cat /usr/src/friendica/VERSION)" - check=true - fi - else - image_version="$(cat /usr/src/friendica/VERSION)" + image_version="$(cat /usr/src/friendica/VERSION)" - # check it just in case the version is greater - if version_greater "$image_version" "$installed_version"; then - check=true - fi - - # no downgrading possible - if version_greater "$installed_version" "$image_version"; then - echo 'Can'\''t copy Friendica sources because the version of the data ('$installed_version') is higher than the docker image ('$image_version')', 0 - exit 1; - fi + # no downgrading possible + if version_greater "$installed_version" "$image_version"; then + echo 'Can'\''t copy Friendica sources because the version of the data ('$installed_version') is higher than the docker image ('$image_version')', 0 + exit 1; fi setup_ssmtp - if [ "$check" = true ]; then + # check it just in case the version is greater + if version_greater "$image_version" "$installed_version"; then echo "Initializing Friendica $image_version ..." if [ "$installed_version" != "0.0.0.0" ]; then @@ -206,7 +135,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then # TODO Workaround because of a strange permission issue rm -fr /var/www/html/view/smarty3/compiled - # load other config files (*.config.php) to the config folder (currently only local.config.php and addon.config.php supported) + # load other config files (*.config.php) to the config folder if [ -d "/usr/src/config" ]; then rsync $rsync_options --ignore-existing /usr/src/config/ /var/www/html/config/ fi diff --git a/2019.09/fpm-alpine/entrypoint.sh b/2019.09/fpm-alpine/entrypoint.sh index 3610ef9..b1d914a 100755 --- a/2019.09/fpm-alpine/entrypoint.sh +++ b/2019.09/fpm-alpine/entrypoint.sh @@ -16,62 +16,6 @@ version_greater() { [ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ] } -# checks if the branch and repository exists -check_branch() { - repo=${1:-} - branch=${2:-} - git ls-remote --heads --tags "https://github.com/$repo" | grep -E "refs/(heads|tags)/${branch}$" >/dev/null - [ "$?" -eq "0" ] -} - -# clones the whole develop branch (Friendica and Addons) -clone_develop() { - friendica_git="${FRIENDICA_VERSION}" - addons_git="${FRIENDICA_ADDONS}" - friendica_repo="${FRIENDICA_REPOSITORY:-friendica/friendica}" - friendica_addons_repo="${FRIENDICA_ADDONS_REPO:-friendica/friendica-addons}" - - if echo "{$friendica_git,,}" | grep -Eq '^.*\-dev'; then - friendica_git="develop" - fi - - if echo "{$addons_git,,}" | grep -Eq '^.*\-dev'; then - addons_git="develop" - fi - - # Check if the branches exist before wiping the - if check_branch "$friendica_repo" "$friendica_git" && check_branch "$friendica_addons_repo" "$addons_git" ; then - echo "Downloading Friendica from GitHub '${friendica_repo}/${friendica_git}' ..." - - # Removing the whole directory first - rm -fr /usr/src/friendica - git clone -q -b ${friendica_git} "https://github.com/${friendica_repo}" /usr/src/friendica - - mkdir /usr/src/friendica/addon - git clone -q -b ${addons_git} "https://github.com/${friendica_addons_repo}" /usr/src/friendica/addon - - echo "Download finished" - - if [ ! -f /usr/src/friendica/VERSION ]; then - echo "Couldn't clone repository" - exit 1 - fi - - /usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica - return 0 - - else - if check_branch "$friendica_repo" "$friendica_git"; then - echo "$friendica_repo/$friendica_git is not valid." - else - echo "$friendica_addons_repo/$addons_git is not valid." - fi - echo "Using old version." - return 1 - - fi -} - setup_ssmtp() { if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..." @@ -112,33 +56,18 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then installed_version="$(cat /var/www/html/VERSION)" fi - check=false - # cloning from git is just possible for develop or Release Candidats - if echo "${FRIENDICA_VERSION}" | grep -Eq '^.*(\-dev|-rc|-RC)' || [ "${FRIENDICA_UPGRADE:-false}" = "true" ] || [ ! -f /usr/src/friendica/VERSION ]; then - # just clone & check if it's a new install or upgrade - clone_develop - if [ "$?" -eq "0" ]; then - image_version="$(cat /usr/src/friendica/VERSION)" - check=true - fi - else - image_version="$(cat /usr/src/friendica/VERSION)" + image_version="$(cat /usr/src/friendica/VERSION)" - # check it just in case the version is greater - if version_greater "$image_version" "$installed_version"; then - check=true - fi - - # no downgrading possible - if version_greater "$installed_version" "$image_version"; then - echo 'Can'\''t copy Friendica sources because the version of the data ('$installed_version') is higher than the docker image ('$image_version')', 0 - exit 1; - fi + # no downgrading possible + if version_greater "$installed_version" "$image_version"; then + echo 'Can'\''t copy Friendica sources because the version of the data ('$installed_version') is higher than the docker image ('$image_version')', 0 + exit 1; fi setup_ssmtp - if [ "$check" = true ]; then + # check it just in case the version is greater + if version_greater "$image_version" "$installed_version"; then echo "Initializing Friendica $image_version ..." if [ "$installed_version" != "0.0.0.0" ]; then @@ -206,7 +135,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then # TODO Workaround because of a strange permission issue rm -fr /var/www/html/view/smarty3/compiled - # load other config files (*.config.php) to the config folder (currently only local.config.php and addon.config.php supported) + # load other config files (*.config.php) to the config folder if [ -d "/usr/src/config" ]; then rsync $rsync_options --ignore-existing /usr/src/config/ /var/www/html/config/ fi diff --git a/2019.09/fpm/entrypoint.sh b/2019.09/fpm/entrypoint.sh index 3610ef9..b1d914a 100755 --- a/2019.09/fpm/entrypoint.sh +++ b/2019.09/fpm/entrypoint.sh @@ -16,62 +16,6 @@ version_greater() { [ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ] } -# checks if the branch and repository exists -check_branch() { - repo=${1:-} - branch=${2:-} - git ls-remote --heads --tags "https://github.com/$repo" | grep -E "refs/(heads|tags)/${branch}$" >/dev/null - [ "$?" -eq "0" ] -} - -# clones the whole develop branch (Friendica and Addons) -clone_develop() { - friendica_git="${FRIENDICA_VERSION}" - addons_git="${FRIENDICA_ADDONS}" - friendica_repo="${FRIENDICA_REPOSITORY:-friendica/friendica}" - friendica_addons_repo="${FRIENDICA_ADDONS_REPO:-friendica/friendica-addons}" - - if echo "{$friendica_git,,}" | grep -Eq '^.*\-dev'; then - friendica_git="develop" - fi - - if echo "{$addons_git,,}" | grep -Eq '^.*\-dev'; then - addons_git="develop" - fi - - # Check if the branches exist before wiping the - if check_branch "$friendica_repo" "$friendica_git" && check_branch "$friendica_addons_repo" "$addons_git" ; then - echo "Downloading Friendica from GitHub '${friendica_repo}/${friendica_git}' ..." - - # Removing the whole directory first - rm -fr /usr/src/friendica - git clone -q -b ${friendica_git} "https://github.com/${friendica_repo}" /usr/src/friendica - - mkdir /usr/src/friendica/addon - git clone -q -b ${addons_git} "https://github.com/${friendica_addons_repo}" /usr/src/friendica/addon - - echo "Download finished" - - if [ ! -f /usr/src/friendica/VERSION ]; then - echo "Couldn't clone repository" - exit 1 - fi - - /usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica - return 0 - - else - if check_branch "$friendica_repo" "$friendica_git"; then - echo "$friendica_repo/$friendica_git is not valid." - else - echo "$friendica_addons_repo/$addons_git is not valid." - fi - echo "Using old version." - return 1 - - fi -} - setup_ssmtp() { if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..." @@ -112,33 +56,18 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then installed_version="$(cat /var/www/html/VERSION)" fi - check=false - # cloning from git is just possible for develop or Release Candidats - if echo "${FRIENDICA_VERSION}" | grep -Eq '^.*(\-dev|-rc|-RC)' || [ "${FRIENDICA_UPGRADE:-false}" = "true" ] || [ ! -f /usr/src/friendica/VERSION ]; then - # just clone & check if it's a new install or upgrade - clone_develop - if [ "$?" -eq "0" ]; then - image_version="$(cat /usr/src/friendica/VERSION)" - check=true - fi - else - image_version="$(cat /usr/src/friendica/VERSION)" + image_version="$(cat /usr/src/friendica/VERSION)" - # check it just in case the version is greater - if version_greater "$image_version" "$installed_version"; then - check=true - fi - - # no downgrading possible - if version_greater "$installed_version" "$image_version"; then - echo 'Can'\''t copy Friendica sources because the version of the data ('$installed_version') is higher than the docker image ('$image_version')', 0 - exit 1; - fi + # no downgrading possible + if version_greater "$installed_version" "$image_version"; then + echo 'Can'\''t copy Friendica sources because the version of the data ('$installed_version') is higher than the docker image ('$image_version')', 0 + exit 1; fi setup_ssmtp - if [ "$check" = true ]; then + # check it just in case the version is greater + if version_greater "$image_version" "$installed_version"; then echo "Initializing Friendica $image_version ..." if [ "$installed_version" != "0.0.0.0" ]; then @@ -206,7 +135,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then # TODO Workaround because of a strange permission issue rm -fr /var/www/html/view/smarty3/compiled - # load other config files (*.config.php) to the config folder (currently only local.config.php and addon.config.php supported) + # load other config files (*.config.php) to the config folder if [ -d "/usr/src/config" ]; then rsync $rsync_options --ignore-existing /usr/src/config/ /var/www/html/config/ fi diff --git a/2019.12-dev/apache/Dockerfile b/2019.12-dev/apache/Dockerfile index f69a817..66b75df 100644 --- a/2019.12-dev/apache/Dockerfile +++ b/2019.12-dev/apache/Dockerfile @@ -127,5 +127,5 @@ ENV FRIENDICA_ADDONS 2019.12-dev COPY *.sh upgrade.exclude / COPY config/* /usr/src/friendica/config/ -ENTRYPOINT ["/entrypoint.sh"] +ENTRYPOINT ["/entrypoint-dev.sh"] CMD ["apache2-foreground"] diff --git a/2019.12-dev/apache/entrypoint-dev.sh b/2019.12-dev/apache/entrypoint-dev.sh new file mode 100755 index 0000000..72c1c21 --- /dev/null +++ b/2019.12-dev/apache/entrypoint-dev.sh @@ -0,0 +1,69 @@ +#!/bin/sh +set -eu + +# checks if the branch and repository exists +check_branch() { + repo=${1:-} + branch=${2:-} + git ls-remote --heads --tags "https://github.com/$repo" | grep -E "refs/(heads|tags)/${branch}$" >/dev/null + [ "$?" -eq "0" ] +} + +# clones the whole develop branch (Friendica and Addons) +clone_develop() { + friendica_git="${FRIENDICA_VERSION}" + addons_git="${FRIENDICA_ADDONS}" + friendica_repo="${FRIENDICA_REPOSITORY:-friendica/friendica}" + friendica_addons_repo="${FRIENDICA_ADDONS_REPO:-friendica/friendica-addons}" + + if echo "{$friendica_git,,}" | grep -Eq '^.*\-dev'; then + friendica_git="develop" + fi + + if echo "{$addons_git,,}" | grep -Eq '^.*\-dev'; then + addons_git="develop" + fi + + # Check if the branches exist before wiping the + if check_branch "$friendica_repo" "$friendica_git" && check_branch "$friendica_addons_repo" "$addons_git" ; then + echo "Cloning '${friendica_git}' from GitHub repository '${friendica_repo}' ..." + + # Removing the whole directory first + rm -fr /usr/src/friendica + git clone -q -b ${friendica_git} "https://github.com/${friendica_repo}" /usr/src/friendica + + mkdir /usr/src/friendica/addon + git clone -q -b ${addons_git} "https://github.com/${friendica_addons_repo}" /usr/src/friendica/addon + + echo "Download finished" + + if [ ! -f /usr/src/friendica/VERSION ]; then + echo "Couldn't clone repository" + exit 1 + fi + + /usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica + return 0 + + else + if check_branch "$friendica_repo" "$friendica_git"; then + echo "$friendica_repo/$friendica_git is not valid." + else + echo "$friendica_addons_repo/$addons_git is not valid." + fi + echo "Using old version." + return 1 + + fi +} + +# just check if we execute apache or php-fpm +if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then + # cloning from git is just possible for develop or Release Candidats + if echo "${FRIENDICA_VERSION}" | grep -Eq '^.*(\-dev|-rc|-RC)' || [ "${FRIENDICA_UPGRADE:-false}" = "true" ] || [ ! -f /usr/src/friendica/VERSION ]; then + # just clone & check if it's a new install or upgrade + clone_develop + fi +fi + +/entrypoint.sh "$@" diff --git a/2019.12-dev/apache/entrypoint.sh b/2019.12-dev/apache/entrypoint.sh index 3610ef9..b1d914a 100755 --- a/2019.12-dev/apache/entrypoint.sh +++ b/2019.12-dev/apache/entrypoint.sh @@ -16,62 +16,6 @@ version_greater() { [ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ] } -# checks if the branch and repository exists -check_branch() { - repo=${1:-} - branch=${2:-} - git ls-remote --heads --tags "https://github.com/$repo" | grep -E "refs/(heads|tags)/${branch}$" >/dev/null - [ "$?" -eq "0" ] -} - -# clones the whole develop branch (Friendica and Addons) -clone_develop() { - friendica_git="${FRIENDICA_VERSION}" - addons_git="${FRIENDICA_ADDONS}" - friendica_repo="${FRIENDICA_REPOSITORY:-friendica/friendica}" - friendica_addons_repo="${FRIENDICA_ADDONS_REPO:-friendica/friendica-addons}" - - if echo "{$friendica_git,,}" | grep -Eq '^.*\-dev'; then - friendica_git="develop" - fi - - if echo "{$addons_git,,}" | grep -Eq '^.*\-dev'; then - addons_git="develop" - fi - - # Check if the branches exist before wiping the - if check_branch "$friendica_repo" "$friendica_git" && check_branch "$friendica_addons_repo" "$addons_git" ; then - echo "Downloading Friendica from GitHub '${friendica_repo}/${friendica_git}' ..." - - # Removing the whole directory first - rm -fr /usr/src/friendica - git clone -q -b ${friendica_git} "https://github.com/${friendica_repo}" /usr/src/friendica - - mkdir /usr/src/friendica/addon - git clone -q -b ${addons_git} "https://github.com/${friendica_addons_repo}" /usr/src/friendica/addon - - echo "Download finished" - - if [ ! -f /usr/src/friendica/VERSION ]; then - echo "Couldn't clone repository" - exit 1 - fi - - /usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica - return 0 - - else - if check_branch "$friendica_repo" "$friendica_git"; then - echo "$friendica_repo/$friendica_git is not valid." - else - echo "$friendica_addons_repo/$addons_git is not valid." - fi - echo "Using old version." - return 1 - - fi -} - setup_ssmtp() { if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..." @@ -112,33 +56,18 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then installed_version="$(cat /var/www/html/VERSION)" fi - check=false - # cloning from git is just possible for develop or Release Candidats - if echo "${FRIENDICA_VERSION}" | grep -Eq '^.*(\-dev|-rc|-RC)' || [ "${FRIENDICA_UPGRADE:-false}" = "true" ] || [ ! -f /usr/src/friendica/VERSION ]; then - # just clone & check if it's a new install or upgrade - clone_develop - if [ "$?" -eq "0" ]; then - image_version="$(cat /usr/src/friendica/VERSION)" - check=true - fi - else - image_version="$(cat /usr/src/friendica/VERSION)" + image_version="$(cat /usr/src/friendica/VERSION)" - # check it just in case the version is greater - if version_greater "$image_version" "$installed_version"; then - check=true - fi - - # no downgrading possible - if version_greater "$installed_version" "$image_version"; then - echo 'Can'\''t copy Friendica sources because the version of the data ('$installed_version') is higher than the docker image ('$image_version')', 0 - exit 1; - fi + # no downgrading possible + if version_greater "$installed_version" "$image_version"; then + echo 'Can'\''t copy Friendica sources because the version of the data ('$installed_version') is higher than the docker image ('$image_version')', 0 + exit 1; fi setup_ssmtp - if [ "$check" = true ]; then + # check it just in case the version is greater + if version_greater "$image_version" "$installed_version"; then echo "Initializing Friendica $image_version ..." if [ "$installed_version" != "0.0.0.0" ]; then @@ -206,7 +135,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then # TODO Workaround because of a strange permission issue rm -fr /var/www/html/view/smarty3/compiled - # load other config files (*.config.php) to the config folder (currently only local.config.php and addon.config.php supported) + # load other config files (*.config.php) to the config folder if [ -d "/usr/src/config" ]; then rsync $rsync_options --ignore-existing /usr/src/config/ /var/www/html/config/ fi diff --git a/2019.12-dev/fpm-alpine/Dockerfile b/2019.12-dev/fpm-alpine/Dockerfile index ec35d99..9d450b6 100644 --- a/2019.12-dev/fpm-alpine/Dockerfile +++ b/2019.12-dev/fpm-alpine/Dockerfile @@ -103,5 +103,5 @@ ENV FRIENDICA_ADDONS 2019.12-dev COPY *.sh upgrade.exclude / COPY config/* /usr/src/friendica/config/ -ENTRYPOINT ["/entrypoint.sh"] +ENTRYPOINT ["/entrypoint-dev.sh"] CMD ["php-fpm"] diff --git a/2019.12-dev/fpm-alpine/entrypoint-dev.sh b/2019.12-dev/fpm-alpine/entrypoint-dev.sh new file mode 100755 index 0000000..72c1c21 --- /dev/null +++ b/2019.12-dev/fpm-alpine/entrypoint-dev.sh @@ -0,0 +1,69 @@ +#!/bin/sh +set -eu + +# checks if the branch and repository exists +check_branch() { + repo=${1:-} + branch=${2:-} + git ls-remote --heads --tags "https://github.com/$repo" | grep -E "refs/(heads|tags)/${branch}$" >/dev/null + [ "$?" -eq "0" ] +} + +# clones the whole develop branch (Friendica and Addons) +clone_develop() { + friendica_git="${FRIENDICA_VERSION}" + addons_git="${FRIENDICA_ADDONS}" + friendica_repo="${FRIENDICA_REPOSITORY:-friendica/friendica}" + friendica_addons_repo="${FRIENDICA_ADDONS_REPO:-friendica/friendica-addons}" + + if echo "{$friendica_git,,}" | grep -Eq '^.*\-dev'; then + friendica_git="develop" + fi + + if echo "{$addons_git,,}" | grep -Eq '^.*\-dev'; then + addons_git="develop" + fi + + # Check if the branches exist before wiping the + if check_branch "$friendica_repo" "$friendica_git" && check_branch "$friendica_addons_repo" "$addons_git" ; then + echo "Cloning '${friendica_git}' from GitHub repository '${friendica_repo}' ..." + + # Removing the whole directory first + rm -fr /usr/src/friendica + git clone -q -b ${friendica_git} "https://github.com/${friendica_repo}" /usr/src/friendica + + mkdir /usr/src/friendica/addon + git clone -q -b ${addons_git} "https://github.com/${friendica_addons_repo}" /usr/src/friendica/addon + + echo "Download finished" + + if [ ! -f /usr/src/friendica/VERSION ]; then + echo "Couldn't clone repository" + exit 1 + fi + + /usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica + return 0 + + else + if check_branch "$friendica_repo" "$friendica_git"; then + echo "$friendica_repo/$friendica_git is not valid." + else + echo "$friendica_addons_repo/$addons_git is not valid." + fi + echo "Using old version." + return 1 + + fi +} + +# just check if we execute apache or php-fpm +if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then + # cloning from git is just possible for develop or Release Candidats + if echo "${FRIENDICA_VERSION}" | grep -Eq '^.*(\-dev|-rc|-RC)' || [ "${FRIENDICA_UPGRADE:-false}" = "true" ] || [ ! -f /usr/src/friendica/VERSION ]; then + # just clone & check if it's a new install or upgrade + clone_develop + fi +fi + +/entrypoint.sh "$@" diff --git a/2019.12-dev/fpm-alpine/entrypoint.sh b/2019.12-dev/fpm-alpine/entrypoint.sh index 3610ef9..b1d914a 100755 --- a/2019.12-dev/fpm-alpine/entrypoint.sh +++ b/2019.12-dev/fpm-alpine/entrypoint.sh @@ -16,62 +16,6 @@ version_greater() { [ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ] } -# checks if the branch and repository exists -check_branch() { - repo=${1:-} - branch=${2:-} - git ls-remote --heads --tags "https://github.com/$repo" | grep -E "refs/(heads|tags)/${branch}$" >/dev/null - [ "$?" -eq "0" ] -} - -# clones the whole develop branch (Friendica and Addons) -clone_develop() { - friendica_git="${FRIENDICA_VERSION}" - addons_git="${FRIENDICA_ADDONS}" - friendica_repo="${FRIENDICA_REPOSITORY:-friendica/friendica}" - friendica_addons_repo="${FRIENDICA_ADDONS_REPO:-friendica/friendica-addons}" - - if echo "{$friendica_git,,}" | grep -Eq '^.*\-dev'; then - friendica_git="develop" - fi - - if echo "{$addons_git,,}" | grep -Eq '^.*\-dev'; then - addons_git="develop" - fi - - # Check if the branches exist before wiping the - if check_branch "$friendica_repo" "$friendica_git" && check_branch "$friendica_addons_repo" "$addons_git" ; then - echo "Downloading Friendica from GitHub '${friendica_repo}/${friendica_git}' ..." - - # Removing the whole directory first - rm -fr /usr/src/friendica - git clone -q -b ${friendica_git} "https://github.com/${friendica_repo}" /usr/src/friendica - - mkdir /usr/src/friendica/addon - git clone -q -b ${addons_git} "https://github.com/${friendica_addons_repo}" /usr/src/friendica/addon - - echo "Download finished" - - if [ ! -f /usr/src/friendica/VERSION ]; then - echo "Couldn't clone repository" - exit 1 - fi - - /usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica - return 0 - - else - if check_branch "$friendica_repo" "$friendica_git"; then - echo "$friendica_repo/$friendica_git is not valid." - else - echo "$friendica_addons_repo/$addons_git is not valid." - fi - echo "Using old version." - return 1 - - fi -} - setup_ssmtp() { if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..." @@ -112,33 +56,18 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then installed_version="$(cat /var/www/html/VERSION)" fi - check=false - # cloning from git is just possible for develop or Release Candidats - if echo "${FRIENDICA_VERSION}" | grep -Eq '^.*(\-dev|-rc|-RC)' || [ "${FRIENDICA_UPGRADE:-false}" = "true" ] || [ ! -f /usr/src/friendica/VERSION ]; then - # just clone & check if it's a new install or upgrade - clone_develop - if [ "$?" -eq "0" ]; then - image_version="$(cat /usr/src/friendica/VERSION)" - check=true - fi - else - image_version="$(cat /usr/src/friendica/VERSION)" + image_version="$(cat /usr/src/friendica/VERSION)" - # check it just in case the version is greater - if version_greater "$image_version" "$installed_version"; then - check=true - fi - - # no downgrading possible - if version_greater "$installed_version" "$image_version"; then - echo 'Can'\''t copy Friendica sources because the version of the data ('$installed_version') is higher than the docker image ('$image_version')', 0 - exit 1; - fi + # no downgrading possible + if version_greater "$installed_version" "$image_version"; then + echo 'Can'\''t copy Friendica sources because the version of the data ('$installed_version') is higher than the docker image ('$image_version')', 0 + exit 1; fi setup_ssmtp - if [ "$check" = true ]; then + # check it just in case the version is greater + if version_greater "$image_version" "$installed_version"; then echo "Initializing Friendica $image_version ..." if [ "$installed_version" != "0.0.0.0" ]; then @@ -206,7 +135,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then # TODO Workaround because of a strange permission issue rm -fr /var/www/html/view/smarty3/compiled - # load other config files (*.config.php) to the config folder (currently only local.config.php and addon.config.php supported) + # load other config files (*.config.php) to the config folder if [ -d "/usr/src/config" ]; then rsync $rsync_options --ignore-existing /usr/src/config/ /var/www/html/config/ fi diff --git a/2019.12-dev/fpm/Dockerfile b/2019.12-dev/fpm/Dockerfile index 32a5df3..1a614c1 100644 --- a/2019.12-dev/fpm/Dockerfile +++ b/2019.12-dev/fpm/Dockerfile @@ -118,5 +118,5 @@ ENV FRIENDICA_ADDONS 2019.12-dev COPY *.sh upgrade.exclude / COPY config/* /usr/src/friendica/config/ -ENTRYPOINT ["/entrypoint.sh"] +ENTRYPOINT ["/entrypoint-dev.sh"] CMD ["php-fpm"] diff --git a/2019.12-dev/fpm/entrypoint-dev.sh b/2019.12-dev/fpm/entrypoint-dev.sh new file mode 100755 index 0000000..72c1c21 --- /dev/null +++ b/2019.12-dev/fpm/entrypoint-dev.sh @@ -0,0 +1,69 @@ +#!/bin/sh +set -eu + +# checks if the branch and repository exists +check_branch() { + repo=${1:-} + branch=${2:-} + git ls-remote --heads --tags "https://github.com/$repo" | grep -E "refs/(heads|tags)/${branch}$" >/dev/null + [ "$?" -eq "0" ] +} + +# clones the whole develop branch (Friendica and Addons) +clone_develop() { + friendica_git="${FRIENDICA_VERSION}" + addons_git="${FRIENDICA_ADDONS}" + friendica_repo="${FRIENDICA_REPOSITORY:-friendica/friendica}" + friendica_addons_repo="${FRIENDICA_ADDONS_REPO:-friendica/friendica-addons}" + + if echo "{$friendica_git,,}" | grep -Eq '^.*\-dev'; then + friendica_git="develop" + fi + + if echo "{$addons_git,,}" | grep -Eq '^.*\-dev'; then + addons_git="develop" + fi + + # Check if the branches exist before wiping the + if check_branch "$friendica_repo" "$friendica_git" && check_branch "$friendica_addons_repo" "$addons_git" ; then + echo "Cloning '${friendica_git}' from GitHub repository '${friendica_repo}' ..." + + # Removing the whole directory first + rm -fr /usr/src/friendica + git clone -q -b ${friendica_git} "https://github.com/${friendica_repo}" /usr/src/friendica + + mkdir /usr/src/friendica/addon + git clone -q -b ${addons_git} "https://github.com/${friendica_addons_repo}" /usr/src/friendica/addon + + echo "Download finished" + + if [ ! -f /usr/src/friendica/VERSION ]; then + echo "Couldn't clone repository" + exit 1 + fi + + /usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica + return 0 + + else + if check_branch "$friendica_repo" "$friendica_git"; then + echo "$friendica_repo/$friendica_git is not valid." + else + echo "$friendica_addons_repo/$addons_git is not valid." + fi + echo "Using old version." + return 1 + + fi +} + +# just check if we execute apache or php-fpm +if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then + # cloning from git is just possible for develop or Release Candidats + if echo "${FRIENDICA_VERSION}" | grep -Eq '^.*(\-dev|-rc|-RC)' || [ "${FRIENDICA_UPGRADE:-false}" = "true" ] || [ ! -f /usr/src/friendica/VERSION ]; then + # just clone & check if it's a new install or upgrade + clone_develop + fi +fi + +/entrypoint.sh "$@" diff --git a/2019.12-dev/fpm/entrypoint.sh b/2019.12-dev/fpm/entrypoint.sh index 3610ef9..b1d914a 100755 --- a/2019.12-dev/fpm/entrypoint.sh +++ b/2019.12-dev/fpm/entrypoint.sh @@ -16,62 +16,6 @@ version_greater() { [ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ] } -# checks if the branch and repository exists -check_branch() { - repo=${1:-} - branch=${2:-} - git ls-remote --heads --tags "https://github.com/$repo" | grep -E "refs/(heads|tags)/${branch}$" >/dev/null - [ "$?" -eq "0" ] -} - -# clones the whole develop branch (Friendica and Addons) -clone_develop() { - friendica_git="${FRIENDICA_VERSION}" - addons_git="${FRIENDICA_ADDONS}" - friendica_repo="${FRIENDICA_REPOSITORY:-friendica/friendica}" - friendica_addons_repo="${FRIENDICA_ADDONS_REPO:-friendica/friendica-addons}" - - if echo "{$friendica_git,,}" | grep -Eq '^.*\-dev'; then - friendica_git="develop" - fi - - if echo "{$addons_git,,}" | grep -Eq '^.*\-dev'; then - addons_git="develop" - fi - - # Check if the branches exist before wiping the - if check_branch "$friendica_repo" "$friendica_git" && check_branch "$friendica_addons_repo" "$addons_git" ; then - echo "Downloading Friendica from GitHub '${friendica_repo}/${friendica_git}' ..." - - # Removing the whole directory first - rm -fr /usr/src/friendica - git clone -q -b ${friendica_git} "https://github.com/${friendica_repo}" /usr/src/friendica - - mkdir /usr/src/friendica/addon - git clone -q -b ${addons_git} "https://github.com/${friendica_addons_repo}" /usr/src/friendica/addon - - echo "Download finished" - - if [ ! -f /usr/src/friendica/VERSION ]; then - echo "Couldn't clone repository" - exit 1 - fi - - /usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica - return 0 - - else - if check_branch "$friendica_repo" "$friendica_git"; then - echo "$friendica_repo/$friendica_git is not valid." - else - echo "$friendica_addons_repo/$addons_git is not valid." - fi - echo "Using old version." - return 1 - - fi -} - setup_ssmtp() { if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..." @@ -112,33 +56,18 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then installed_version="$(cat /var/www/html/VERSION)" fi - check=false - # cloning from git is just possible for develop or Release Candidats - if echo "${FRIENDICA_VERSION}" | grep -Eq '^.*(\-dev|-rc|-RC)' || [ "${FRIENDICA_UPGRADE:-false}" = "true" ] || [ ! -f /usr/src/friendica/VERSION ]; then - # just clone & check if it's a new install or upgrade - clone_develop - if [ "$?" -eq "0" ]; then - image_version="$(cat /usr/src/friendica/VERSION)" - check=true - fi - else - image_version="$(cat /usr/src/friendica/VERSION)" + image_version="$(cat /usr/src/friendica/VERSION)" - # check it just in case the version is greater - if version_greater "$image_version" "$installed_version"; then - check=true - fi - - # no downgrading possible - if version_greater "$installed_version" "$image_version"; then - echo 'Can'\''t copy Friendica sources because the version of the data ('$installed_version') is higher than the docker image ('$image_version')', 0 - exit 1; - fi + # no downgrading possible + if version_greater "$installed_version" "$image_version"; then + echo 'Can'\''t copy Friendica sources because the version of the data ('$installed_version') is higher than the docker image ('$image_version')', 0 + exit 1; fi setup_ssmtp - if [ "$check" = true ]; then + # check it just in case the version is greater + if version_greater "$image_version" "$installed_version"; then echo "Initializing Friendica $image_version ..." if [ "$installed_version" != "0.0.0.0" ]; then @@ -206,7 +135,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then # TODO Workaround because of a strange permission issue rm -fr /var/www/html/view/smarty3/compiled - # load other config files (*.config.php) to the config folder (currently only local.config.php and addon.config.php supported) + # load other config files (*.config.php) to the config folder if [ -d "/usr/src/config" ]; then rsync $rsync_options --ignore-existing /usr/src/config/ /var/www/html/config/ fi diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index 2c9b9db..45e9151 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -102,5 +102,5 @@ ENV FRIENDICA_ADDONS %%VERSION%% COPY *.sh upgrade.exclude / COPY config/* /usr/src/friendica/config/ -ENTRYPOINT ["/entrypoint.sh"] +ENTRYPOINT ["/%%ENTRYPOINT%%"] CMD ["%%CMD%%"] diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index d866128..bbe7253 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -117,5 +117,5 @@ ENV FRIENDICA_ADDONS %%VERSION%% COPY *.sh upgrade.exclude / COPY config/* /usr/src/friendica/config/ -ENTRYPOINT ["/entrypoint.sh"] +ENTRYPOINT ["/%%ENTRYPOINT%%"] CMD ["%%CMD%%"] diff --git a/README-DEV.md b/README-DEV.md new file mode 100644 index 0000000..07b92af --- /dev/null +++ b/README-DEV.md @@ -0,0 +1,21 @@ +# Special settings for DEV/RC images + +The `*-dev` and `*-rc` branches are having additional possibilities to get the latest sources of Friendica. + +## Possible Environment Variables + +The following environment variables are possible for these kind of images too: + +**Develop/Release Candidat Settings** +- `FRIENDICA_UPGRADE` If set to `true`, a develop or release candidat node will get updated at startup. +- `FRIENDICA_REPOSITORY` If set, a custom repository will be chosen (Default: `friendica`) +- `FRIENDICA_ADDONS_REPO` If set, a custom repository for the addons will be chosen (Default: `friendica`) +- `FRIENDICA_VERSION` If set, a custom branch will be chosen (Default is based on the chosen image version) +- `FRIENDICA_ADDONS` If set, a custom branch for the addons will be chosen (Default is based on the chosen image version) + +## Updating to a newer version + +You don't need to pull the image for each commit in [friendica](https://github.com/friendica/friendica/). +Instead, the release candidate or develop branch will get updated if no installation was found or the environment variable `FRIENDICA_UPGRADE` is set to `true`. + +It will clone the latest Friendica version and copy it to your working directory. diff --git a/README.md b/README.md index ec59296..2669fa4 100644 --- a/README.md +++ b/README.md @@ -95,13 +95,6 @@ There are three options to enable the cron-job for Friendica: - `REDIS_PW` (optional) The password for the redis instance (in case of locking). - `REDIS_DB` (optional) The database instance of the redis instance (in case of locking). -**Develop/Release Candidat Settings** -- `FRIENDICA_UPGRADE` If set to `true`, a develop or release candidat node will get updated at startup. -- `FRIENDICA_REPOSITORY` If set, a custom repository will be chosen (Default: `friendica`) -- `FRIENDICA_ADDONS_REPO` If set, a custom repository for the addons will be chosen (Default: `friendica`) -- `FRIENDICA_VERSION` If set, a custom branch will be chosen (Default is based on the chosen image version) -- `FRIENDICA_ADDONS` If set, a custom branch for the addons will be chosen (Default is based on the chosen image version) - ## Administrator account Because Friendica links the administrator account to a specific mail address, you **have** to set a valid address for `MAILNAME`. @@ -184,20 +177,9 @@ If no other environment variable is set, this `local.config.php` will get copied ## Updating to a newer version -There are differences between the deveop (everything which ends with `-rc` or `-dev`) and the stable (the rest) branches. - -### Updating stable - You have to pull the latest image from the hub (`docker pull friendica`). The stable branch gets checked at every startup and will get updated if no installation was found or a new image is used. -### Updating develop - -You don't need to pull the image for each commit in [friendica](https://github.com/friendica/friendica/). -Instead, the develop branch will get updated if no installation was found or the environment variable `FRIENDICA_UPGRADE` is set to `true`. - -It will clone the latest Friendica version and copy it to your working directory. - # Running this image with docker-compose The easiest way to get a fully featured and functional setup is using a `docker-compose` file. diff --git a/docker-entrypoint-dev.sh b/docker-entrypoint-dev.sh new file mode 100755 index 0000000..72c1c21 --- /dev/null +++ b/docker-entrypoint-dev.sh @@ -0,0 +1,69 @@ +#!/bin/sh +set -eu + +# checks if the branch and repository exists +check_branch() { + repo=${1:-} + branch=${2:-} + git ls-remote --heads --tags "https://github.com/$repo" | grep -E "refs/(heads|tags)/${branch}$" >/dev/null + [ "$?" -eq "0" ] +} + +# clones the whole develop branch (Friendica and Addons) +clone_develop() { + friendica_git="${FRIENDICA_VERSION}" + addons_git="${FRIENDICA_ADDONS}" + friendica_repo="${FRIENDICA_REPOSITORY:-friendica/friendica}" + friendica_addons_repo="${FRIENDICA_ADDONS_REPO:-friendica/friendica-addons}" + + if echo "{$friendica_git,,}" | grep -Eq '^.*\-dev'; then + friendica_git="develop" + fi + + if echo "{$addons_git,,}" | grep -Eq '^.*\-dev'; then + addons_git="develop" + fi + + # Check if the branches exist before wiping the + if check_branch "$friendica_repo" "$friendica_git" && check_branch "$friendica_addons_repo" "$addons_git" ; then + echo "Cloning '${friendica_git}' from GitHub repository '${friendica_repo}' ..." + + # Removing the whole directory first + rm -fr /usr/src/friendica + git clone -q -b ${friendica_git} "https://github.com/${friendica_repo}" /usr/src/friendica + + mkdir /usr/src/friendica/addon + git clone -q -b ${addons_git} "https://github.com/${friendica_addons_repo}" /usr/src/friendica/addon + + echo "Download finished" + + if [ ! -f /usr/src/friendica/VERSION ]; then + echo "Couldn't clone repository" + exit 1 + fi + + /usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica + return 0 + + else + if check_branch "$friendica_repo" "$friendica_git"; then + echo "$friendica_repo/$friendica_git is not valid." + else + echo "$friendica_addons_repo/$addons_git is not valid." + fi + echo "Using old version." + return 1 + + fi +} + +# just check if we execute apache or php-fpm +if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then + # cloning from git is just possible for develop or Release Candidats + if echo "${FRIENDICA_VERSION}" | grep -Eq '^.*(\-dev|-rc|-RC)' || [ "${FRIENDICA_UPGRADE:-false}" = "true" ] || [ ! -f /usr/src/friendica/VERSION ]; then + # just clone & check if it's a new install or upgrade + clone_develop + fi +fi + +/entrypoint.sh "$@" diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 3610ef9..b1d914a 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -16,62 +16,6 @@ version_greater() { [ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ] } -# checks if the branch and repository exists -check_branch() { - repo=${1:-} - branch=${2:-} - git ls-remote --heads --tags "https://github.com/$repo" | grep -E "refs/(heads|tags)/${branch}$" >/dev/null - [ "$?" -eq "0" ] -} - -# clones the whole develop branch (Friendica and Addons) -clone_develop() { - friendica_git="${FRIENDICA_VERSION}" - addons_git="${FRIENDICA_ADDONS}" - friendica_repo="${FRIENDICA_REPOSITORY:-friendica/friendica}" - friendica_addons_repo="${FRIENDICA_ADDONS_REPO:-friendica/friendica-addons}" - - if echo "{$friendica_git,,}" | grep -Eq '^.*\-dev'; then - friendica_git="develop" - fi - - if echo "{$addons_git,,}" | grep -Eq '^.*\-dev'; then - addons_git="develop" - fi - - # Check if the branches exist before wiping the - if check_branch "$friendica_repo" "$friendica_git" && check_branch "$friendica_addons_repo" "$addons_git" ; then - echo "Downloading Friendica from GitHub '${friendica_repo}/${friendica_git}' ..." - - # Removing the whole directory first - rm -fr /usr/src/friendica - git clone -q -b ${friendica_git} "https://github.com/${friendica_repo}" /usr/src/friendica - - mkdir /usr/src/friendica/addon - git clone -q -b ${addons_git} "https://github.com/${friendica_addons_repo}" /usr/src/friendica/addon - - echo "Download finished" - - if [ ! -f /usr/src/friendica/VERSION ]; then - echo "Couldn't clone repository" - exit 1 - fi - - /usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica - return 0 - - else - if check_branch "$friendica_repo" "$friendica_git"; then - echo "$friendica_repo/$friendica_git is not valid." - else - echo "$friendica_addons_repo/$addons_git is not valid." - fi - echo "Using old version." - return 1 - - fi -} - setup_ssmtp() { if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..." @@ -112,33 +56,18 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then installed_version="$(cat /var/www/html/VERSION)" fi - check=false - # cloning from git is just possible for develop or Release Candidats - if echo "${FRIENDICA_VERSION}" | grep -Eq '^.*(\-dev|-rc|-RC)' || [ "${FRIENDICA_UPGRADE:-false}" = "true" ] || [ ! -f /usr/src/friendica/VERSION ]; then - # just clone & check if it's a new install or upgrade - clone_develop - if [ "$?" -eq "0" ]; then - image_version="$(cat /usr/src/friendica/VERSION)" - check=true - fi - else - image_version="$(cat /usr/src/friendica/VERSION)" + image_version="$(cat /usr/src/friendica/VERSION)" - # check it just in case the version is greater - if version_greater "$image_version" "$installed_version"; then - check=true - fi - - # no downgrading possible - if version_greater "$installed_version" "$image_version"; then - echo 'Can'\''t copy Friendica sources because the version of the data ('$installed_version') is higher than the docker image ('$image_version')', 0 - exit 1; - fi + # no downgrading possible + if version_greater "$installed_version" "$image_version"; then + echo 'Can'\''t copy Friendica sources because the version of the data ('$installed_version') is higher than the docker image ('$image_version')', 0 + exit 1; fi setup_ssmtp - if [ "$check" = true ]; then + # check it just in case the version is greater + if version_greater "$image_version" "$installed_version"; then echo "Initializing Friendica $image_version ..." if [ "$installed_version" != "0.0.0.0" ]; then @@ -206,7 +135,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then # TODO Workaround because of a strange permission issue rm -fr /var/www/html/view/smarty3/compiled - # load other config files (*.config.php) to the config folder (currently only local.config.php and addon.config.php supported) + # load other config files (*.config.php) to the config folder if [ -d "/usr/src/config" ]; then rsync $rsync_options --ignore-existing /usr/src/config/ /var/www/html/config/ fi diff --git a/update.sh b/update.sh index 0d46f27..66e688f 100755 --- a/update.sh +++ b/update.sh @@ -23,6 +23,11 @@ declare -A extras=( [fpm-alpine]='' ) +declare -A entrypoints=( + [stable]='entrypoint.sh' + [develop]='entrypoint-dev.sh' +) + apcu_version="$( git ls-remote --tags https://github.com/krakjoe/apcu.git \ | cut -d/ -f3 \ @@ -116,12 +121,17 @@ function create_variant() { s/%%IMAGICK_VERSION%%/'"${pecl_versions[imagick]}"'/g; s/%%MEMCACHED_VERSION%%/'"${pecl_versions[memcached]}"'/g; s/%%REDIS_VERSION%%/'"${pecl_versions[redis]}"'/g; + s/%%ENTRYPOINT%%/'"${entrypoints[$install_type]}"'/g; ' "$dir/Dockerfile" for name in entrypoint cron; do cp "docker-$name.sh" "$dir/$name.sh" done + if [[ $install_type == "develop" ]]; then + cp "docker-entrypoint-dev.sh" "$dir/entrypoint-dev.sh" + fi + cp upgrade.exclude "$dir/" cp -rT .config "$dir/config"