Docker: bitbucket pipelines ext-zip *

2019-08-06 03:54发布

问题:

I'm trying to set up pipelines with Bitbucket for one of the Laravel driven project and I've spent already hours trying to get it to work, but just can't get over the following:

+ composer install
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - Installation request for facebook/webdriver 1.5.0 -> satisfiable by facebook/webdriver[1.5.0].
    - facebook/webdriver 1.5.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
  Problem 2
    - facebook/webdriver 1.5.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - laravel/dusk v2.0.8 requires facebook/webdriver ~1.0 -> satisfiable by facebook/webdriver[1.5.0].
    - Installation request for laravel/dusk v2.0.8 -> satisfiable by laravel/dusk[v2.0.8].

My config file

image: php:7.2.1

pipelines:
  default:
    - step:
        caches:
          - composer
        script:
          - apt-get update && apt-get install -y unzip
          - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
          - apt-get update && apt-get install -qy git curl libmcrypt-dev mysql-client libzip-dev zip
          - docker-php-ext-install mcrypt && docker-php-ext-install pdo_mysql && docker-php-ext-install zip
          - composer install
          - php artisan key:generate
          - export CACHE_DRIVER=redis
          - export SESSION_DRIVER=redis
          - export DB_CONNECTION=mysql
          - vendor/bin/phpunit -c phpunit.xml
        services:
          - mysql

definitions:
  services:
    mysql:
      image: mysql
      environment:
        MYSQL_DATABASE: 'homestead'
        MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
        MYSQL_USER: 'homestead'
        MYSQL_PASSWORD: 'secret'

The output of the docker-php-ext-install mcrypt && docker-php-ext-install pdo_mysql && docker-php-ext-install zip

+ docker-php-ext-install mcrypt && docker-php-ext-install pdo_mysql && docker-php-ext-install zip
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.

Does anyone know what might be causing it?

回答1:

As clearly visible from the output, the docker-php-ext-install mcrypt command fails because mcrypt is not a module installable via docker-php-ext-install and all following commands in that line of the script don't get executed. That means that the zip extension is not installed and causes composer to fail.

Try removing that part from the script and try again