Loading README.md +2 −8 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ the image. For this, you may use the following files (located in `PHP_PROJECT_DIR`): * `.php_apt_get` and `.php_apk` containing required system libraries (in a single line), * `.php_packages` containing required system libraries (in a single line), * `.php_pecl` containing required PECL extensions (in a single line), * `.php_ext` containing required PHP extensions (in a single line). Loading @@ -62,13 +62,7 @@ More info [in _How to install more PHP extensions_ chapter](https://hub.docker.c Example: a project requires `php-gd` and `php-zip` extensions (themselves requiring `libzip-dev` and `libpng-dev` libraries) `.php_apt_get`: ```text libzip-dev libpng-dev ``` `.php_apk`: `.php_packages`: ```text libzip-dev libpng-dev Loading templates/gitlab-ci-php.yml +51 −20 Original line number Diff line number Diff line Loading @@ -257,32 +257,63 @@ stages: log_info "... done" } # install PHP system dependencies function install_project_deps() { if command -v apt-get >/dev/null 2>&1 function maybe_install_pkg() { pkg_name="$1" cmd_name="${2:-$pkg_name}" if ! command -v "$cmd_name" > /dev/null then # install zip & unzip (required to unzip dist packages) git (required by composer) apt-get update -yqq apt-get install zip unzip git -yqq if [[ -f ".php_apt_get" ]] log_info "$pkg_name not found: install..." if command -v apt-get > /dev/null then log_info "file \\e[33;1m.php_apt_get\\e[0m found: install project system dependencies..." # shellcheck disable=SC2046 apt-get install -yqq $(cat .php_apt_get) apt-get -yqq install "$pkg_name" || log_warn "... failed to install $pkg_name" elif command -v apk > /dev/null then apk add -q --no-cache "$pkg_name" || log_warn "... failed to install $pkg_name" elif command -v yum > /dev/null then yum install -yq "$pkg_name" || log_warn "... failed to install $pkg_name" elif command -v dnf > /dev/null then dnf install -yq "$pkg_name" || log_warn "... failed to install $pkg_name" elif command -v zypper > /dev/null then zypper -nq install "$pkg_name" || log_warn "... failed to install $pkg_name" else log_error "... didn't find any known package manager to install $pkg_name!" exit 1 fi fi } if command -v apk >/dev/null 2>&1 # install PHP system dependencies function install_project_deps() { # prepare package manager if command -v apt-get > /dev/null then apt-get -yqq update fi # install zip & unzip (required to unzip dist packages) git (required by composer) linux-headers $PHPIZE_DEPS (required by pecl) # shellcheck disable=SC2086 apk --update -q add zip unzip git linux-headers $PHPIZE_DEPS if [[ -f ".php_apk" ]] packages="zip unzip git linux-headers $PHPIZE_DEPS" for pkg in $packages do maybe_install_pkg "$pkg" done packages_file=".php_packages" if [[ -f ".php_apt_get" ]] then log_info "file \\e[33;1m.php_apk\\e[0m found: install project system dependencies..." # shellcheck disable=SC2046 apk add -q $(cat .php_apk) log_warn "using .php_apt_get is deprecated: use .php_packages instead" packages_file=".php_apt_get" fi if [[ -f "$packages_file" ]] then log_info "file \\e[33;1m.php_packages\\e[0m found: install project system dependencies..." # shellcheck disable=SC2013 for pkg in $(cat "$packages_file") do maybe_install_pkg "$pkg" done fi # set proxy for pear Loading Loading
README.md +2 −8 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ the image. For this, you may use the following files (located in `PHP_PROJECT_DIR`): * `.php_apt_get` and `.php_apk` containing required system libraries (in a single line), * `.php_packages` containing required system libraries (in a single line), * `.php_pecl` containing required PECL extensions (in a single line), * `.php_ext` containing required PHP extensions (in a single line). Loading @@ -62,13 +62,7 @@ More info [in _How to install more PHP extensions_ chapter](https://hub.docker.c Example: a project requires `php-gd` and `php-zip` extensions (themselves requiring `libzip-dev` and `libpng-dev` libraries) `.php_apt_get`: ```text libzip-dev libpng-dev ``` `.php_apk`: `.php_packages`: ```text libzip-dev libpng-dev Loading
templates/gitlab-ci-php.yml +51 −20 Original line number Diff line number Diff line Loading @@ -257,32 +257,63 @@ stages: log_info "... done" } # install PHP system dependencies function install_project_deps() { if command -v apt-get >/dev/null 2>&1 function maybe_install_pkg() { pkg_name="$1" cmd_name="${2:-$pkg_name}" if ! command -v "$cmd_name" > /dev/null then # install zip & unzip (required to unzip dist packages) git (required by composer) apt-get update -yqq apt-get install zip unzip git -yqq if [[ -f ".php_apt_get" ]] log_info "$pkg_name not found: install..." if command -v apt-get > /dev/null then log_info "file \\e[33;1m.php_apt_get\\e[0m found: install project system dependencies..." # shellcheck disable=SC2046 apt-get install -yqq $(cat .php_apt_get) apt-get -yqq install "$pkg_name" || log_warn "... failed to install $pkg_name" elif command -v apk > /dev/null then apk add -q --no-cache "$pkg_name" || log_warn "... failed to install $pkg_name" elif command -v yum > /dev/null then yum install -yq "$pkg_name" || log_warn "... failed to install $pkg_name" elif command -v dnf > /dev/null then dnf install -yq "$pkg_name" || log_warn "... failed to install $pkg_name" elif command -v zypper > /dev/null then zypper -nq install "$pkg_name" || log_warn "... failed to install $pkg_name" else log_error "... didn't find any known package manager to install $pkg_name!" exit 1 fi fi } if command -v apk >/dev/null 2>&1 # install PHP system dependencies function install_project_deps() { # prepare package manager if command -v apt-get > /dev/null then apt-get -yqq update fi # install zip & unzip (required to unzip dist packages) git (required by composer) linux-headers $PHPIZE_DEPS (required by pecl) # shellcheck disable=SC2086 apk --update -q add zip unzip git linux-headers $PHPIZE_DEPS if [[ -f ".php_apk" ]] packages="zip unzip git linux-headers $PHPIZE_DEPS" for pkg in $packages do maybe_install_pkg "$pkg" done packages_file=".php_packages" if [[ -f ".php_apt_get" ]] then log_info "file \\e[33;1m.php_apk\\e[0m found: install project system dependencies..." # shellcheck disable=SC2046 apk add -q $(cat .php_apk) log_warn "using .php_apt_get is deprecated: use .php_packages instead" packages_file=".php_apt_get" fi if [[ -f "$packages_file" ]] then log_info "file \\e[33;1m.php_packages\\e[0m found: install project system dependencies..." # shellcheck disable=SC2013 for pkg in $(cat "$packages_file") do maybe_install_pkg "$pkg" done fi # set proxy for pear Loading