在 mcrypt 扩展上使用 GitlabCI 部署 Laravel 失败

Deploy Laravel with GitlabCI failed on mcrypt extension

我想用 GitLabCI 和 docker 部署我的 Laravel 项目。我有一个包含以下 before_script 的 yaml 文件:

docker-php-ext-install mbstring mcrypt pdo_mysql curl json intl gd xml zip bz2 opcache

它的 return 是这样的:

error: /usr/src/php/ext/mcrypt does not exist

usage: /usr/local/bin/docker-php-ext-install [-jN] ext-name [ext-name ...]
   ie: /usr/local/bin/docker-php-ext-install gd mysqli
       /usr/local/bin/docker-php-ext-install pdo pdo_mysql
       /usr/local/bin/docker-php-ext-install -j5 gd mbstring mysqli pdo pdo_mysql shmop

if custom ./configure arguments are necessary, see docker-php-ext-configure

Possible values for ext-name:
bcmath bz2 calendar ctype curl dba dom enchant exif fileinfo filter ftp gd gettext gmp hash iconv imap interbase intl json ldap mbstring mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline recode reflection session shmop simplexml snmp soap sockets sodium spl standard sysvmsg sysvsem sysvshm tidy tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl zend_test zip

Some of the above modules are already compiled into PHP; please check
the output of "php -i" to see which modules are already loaded.
ERROR: Job failed: exit code 1

我也尝试在 these answers, but nothing worked for me. Cheked this 论坛 post 下使用 apt-get install 手动安装 mcrypt,但是没有提到这个错误。

gitlab-ci.yaml 文件:

before_script:
  # Update packages 
  - apt-get update -yqq

  - apt-get install -my wget gnupg
  # Upgrade to Node 7
  - curl -sL https://deb.nodesource.com/setup_7.x | bash -

  # Install dependencies
  - apt-get install bzip2 git nodejs libcurl4-gnutls-dev libicu-dev libmcrypt-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libpq-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev -yqq

  # Install php extensions
  - docker-php-ext-install mbstring pdo_mysql curl json intl gd xml zip bz2 opcache

  # Install Node dependencies.
  # comment this out if you don't have a node dependency
  - npm install
  - npm install -g bower
  - npm install -g gulp-cli

  # Install Composer and project dependencies.
  - curl -sS https://getcomposer.org/installer | php
  - php composer.phar install 

使用 php7.0 和 Laravel 5.3.2

我运行进入这个问题。 Mcrypt 在 PHP 7.2 中被弃用。下面是现在如何绕过它:

  image: php:7.2

  before_script:
    # Update packages
    - apt-get update -yqq

    # Install dependencies
    - apt-get install git libcurl4-gnutls-dev libicu-dev libmcrypt-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libpq-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev -yqq

    # Install php extensions
    - docker-php-ext-install mbstring pdo_mysql curl json intl gd xml zip bz2 opcache pcntl

    ....    

    # PHP 7.2 Mcrypt & pcntl
    - pecl install mcrypt-1.0.1
    - docker-php-ext-enable mcrypt

    ....