Commit 9ffae7da authored by Clement Bois's avatar Clement Bois
Browse files

feat: alpine compatibility

parent c513c788
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ the image.

For this, you may use the following files (located in `PHP_PROJECT_DIR`):

* `.php_apt_get` containing required system libraries (in a single line),
* `.php_apt_get` and `.php_apk` 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).

@@ -68,6 +68,12 @@ Example: a project requires `php-gd` and `php-zip` extensions (themselves requir
libzip-dev libpng-dev
```

`.php_apk`:

```text
libzip-dev libpng-dev
```

`.php_ext`:

```text
+29 −19
Original line number Diff line number Diff line
@@ -259,22 +259,41 @@ stages:

  # install PHP system dependencies
  function install_project_deps() {
    if command -v apt-get >/dev/null 2>&1
    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" ]]
      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)
      fi
    fi

    if [[ -f ".php_pecl" ]]
    if command -v apk >/dev/null 2>&1
    then
      log_info "file \\e[33;1m.php_pecl\\e[0m file found: install project extensions..."
      # 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" ]]
      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)
      fi
    fi

    # set proxy for pear
    # shellcheck disable=SC2154
    if [[ "${http_proxy}"  ]]; 
    then
      pear config-set http_proxy "${http_proxy}"
    fi
    if [[ -f ".php_pecl" ]]
    then
      log_info "file \\e[33;1m.php_pecl\\e[0m file found: install project extensions..."
      # shellcheck disable=SC2046
      pecl install $(cat .php_pecl)
    fi
@@ -338,9 +357,6 @@ stages:
    - !reference [.php-scripts]
    - install_ca_certs "${CUSTOM_CA_CERTS:-$DEFAULT_CA_CERTS}"
    - cd $PHP_PROJECT_DIR
    # install zip & unzip (required to unzip dist packages) git (required by composer)
    - apt-get update -yqq
    - apt-get install zip unzip git -yqq
    # install project system dependencies (if any)
    - install_project_deps
    # install project dependencies
@@ -358,12 +374,6 @@ php-unit:
  stage: build
  script:
    # install Xdebug
    - |
      # set proxy for pear
      if [[ "${http_proxy}" ]];
      then
        pear config-set http_proxy "${http_proxy}"
      fi
    - pecl install xdebug
    - docker-php-ext-enable xdebug
    - set_xdebug_mode