composer / docker

Composer in Docker
https://hub.docker.com/_/composer/
MIT License
274 stars 133 forks source link

Script php artisan optimize handling the post-install-cmd event returned with error code 1 #269

Closed Doumham-Armah closed 1 year ago

Doumham-Armah commented 1 year ago

i am trying to dockerize a Laravel Artisan app, but I am facing the following error when I run composer install:

[stage-0 9/9] RUN composer install:
#15 0.240 Composer plugins have been disabled for safety in this non-interactive session. Set COMPOSER_ALLOW_SUPERUSER=1 if you want to allow plugins to run as root/super user.
#15 0.240 Do not run Composer as root/super user! See https://getcomposer.org/root for details
#15 0.270 Installing dependencies from lock file (including require-dev)
#15 0.272 Verifying lock file contents can be installed on current platform.
#15 0.280 Package operations: 82 installs, 0 updates, 0 removals
#15 0.281   - Downloading vlucas/phpdotenv (v1.1.1)
#15 0.281   - Downloading symfony/var-dumper (v2.7.36)
#15 0.282   - Downloading symfony/translation (v2.7.36)
#15 0.282   - Downloading symfony/routing (v2.7.36)
#15 0.282   - Downloading symfony/process (v2.7.36)
#15 0.282   - Downloading symfony/polyfill-mbstring (v1.6.0)
#15 0.283   - Downloading symfony/http-foundation (v2.7.36)
#15 0.283   - Downloading symfony/event-dispatcher (v2.8.29)
#15 0.283   - Downloading psr/log (1.0.2)
#15 0.283   - Downloading symfony/debug (v2.7.36)
#15 0.283   - Downloading symfony/http-kernel (v2.7.36)
#15 0.283   - Downloading symfony/finder (v2.7.36)
#15 0.284   - Downloading symfony/dom-crawler (v2.7.36)
#15 0.284   - Downloading symfony/css-selector (v2.8.29)
#15 0.284   - Downloading symfony/console (v2.7.36)
#15 0.284   - Downloading swiftmailer/swiftmailer (v5.4.8)
#15 0.285   - Downloading nikic/php-parser (v2.1.1)
#15 0.285   - Downloading jakub-onderka/php-console-color (0.1)
#15 0.285   - Downloading jakub-onderka/php-console-highlighter (v0.3.2)
#15 0.285   - Downloading dnoegel/php-xdg-base-dir (0.1)
#15 0.285   - Downloading psy/psysh (v0.7.2)
#15 0.285   - Downloading paragonie/random_compat (v1.4.2)
#15 0.286   - Downloading nesbot/carbon (1.22.1)
#15 0.286   - Downloading mtdowling/cron-expression (v1.2.1)
#15 0.286   - Downloading monolog/monolog (1.23.0)
#15 0.286   - Downloading league/flysystem (1.0.41)
#15 0.286   - Downloading symfony/polyfill-util (v1.6.0)
#15 0.286   - Downloading symfony/polyfill-php56 (v1.6.0)
#15 0.286   - Downloading jeremeamia/superclosure (2.3.0)
#15 0.287   - Downloading doctrine/inflector (v1.1.0)
#15 0.287   - Downloading danielstjules/stringy (1.10.0)
#15 0.287   - Downloading classpreloader/classpreloader (3.1.0)
#15 0.288   - Downloading laravel/framework (v5.1.46)
#15 0.288   - Downloading phenx/php-font-lib (0.2.2)
#15 0.288   - Downloading dompdf/dompdf (v0.6.2)
#15 0.288   - Downloading barryvdh/laravel-dompdf (v0.6.1)
#15 0.288   - Downloading caffeinated/modules (v2.2.4)
#15 0.288   - Downloading daniel-zahariev/php-aws-ses (0.8.9)
#15 0.288   - Downloading fzaninotto/faker (v1.7.1)
#15 0.288   - Downloading psr/http-message (1.0.1)
#15 0.288   - Downloading guzzlehttp/psr7 (1.4.2)
#15 0.289   - Downloading guzzlehttp/promises (v1.3.1)
#15 0.289   - Downloading guzzlehttp/guzzle (6.3.0)
#15 0.289   - Downloading hashids/hashids (1.0.6)
#15 0.289   - Downloading intervention/image (2.4.1)
#15 0.289   - Downloading ipunkt/laravel-analytics (1.3.5)
#15 0.290   - Downloading ixudra/curl (6.15.1)
#15 0.290   - Downloading mtdowling/jmespath.php (2.4.0)
#15 0.290   - Downloading aws/aws-sdk-php (dev-master 9f70427)
#15 0.290   - Downloading league/flysystem-aws-s3-v3 (1.0.23)
#15 0.290   - Downloading tijsverkoyen/css-to-inline-styles (1.5.5)
#15 0.290   - Downloading phpoffice/phpexcel (1.8.1)
#15 0.291   - Downloading maatwebsite/excel (v2.0.10)
#15 0.291   - Downloading hamcrest/hamcrest-php (v1.2.2)
#15 0.291   - Downloading mockery/mockery (0.9.9)
#15 0.291   - Downloading webmozart/assert (1.2.0)
#15 0.292   - Downloading phpdocumentor/reflection-common (1.0.1)
#15 0.292   - Downloading phpdocumentor/type-resolver (0.3.0)
#15 0.292   - Downloading phpdocumentor/reflection-docblock (3.2.2)
#15 0.292   - Downloading symfony/yaml (v3.3.11)
#15 0.292   - Downloading sebastian/recursion-context (1.0.5)
#15 0.292   - Downloading sebastian/exporter (1.2.2)
#15 0.292   - Downloading sebastian/diff (1.4.3)
#15 0.293   - Downloading sebastian/comparator (1.2.4)
#15 0.293   - Downloading doctrine/instantiator (1.0.5)
#15 0.293   - Downloading phpspec/prophecy (v1.7.2)
#15 0.293   - Downloading phpspec/php-diff (v1.0.2)
#15 0.293   - Downloading phpspec/phpspec (2.5.8)
#15 0.293   - Downloading phpunit/php-token-stream (1.4.11)
#15 0.293   - Downloading sebastian/version (1.0.6)
#15 0.294   - Downloading sebastian/global-state (1.1.1)
#15 0.294   - Downloading sebastian/environment (1.3.8)
#15 0.294   - Downloading phpunit/php-text-template (1.2.1)
#15 0.294   - Downloading phpunit/phpunit-mock-objects (2.3.8)
#15 0.294   - Downloading phpunit/php-timer (1.0.9)
#15 0.294   - Downloading phpunit/php-file-iterator (1.4.2)
#15 0.294   - Downloading phpunit/php-code-coverage (2.2.4)
#15 0.294   - Downloading phpunit/phpunit (4.8.36)
#15 0.295   - Downloading predis/predis (v1.1.6)
#15 0.295   - Downloading sarav/laravel-multiauth (0.0.5)
#15 0.295   - Downloading bacon/bacon-qr-code (1.0.3)
#15 0.295   - Downloading simplesoftwareio/simple-qrcode (1.5.1)
#15 0.300   0/82 [>---------------------------]   0%
#15 1.368   9/82 [===>------------------------]  10%
#15 1.887  17/82 [=====>----------------------]  20%
#15 2.387  29/82 [=========>------------------]  35%
#15 2.638  33/82 [===========>----------------]  40%
#15 3.643  39/82 [=============>--------------]  47%
#15 3.846  41/82 [==============>-------------]  50%
#15 4.864  47/82 [================>-----------]  57%
#15 5.368  50/82 [=================>----------]  60%
#15 6.384  58/82 [===================>--------]  70%
#15 7.417  65/82 [======================>-----]  79%
#15 7.519  66/82 [======================>-----]  80%
#15 8.489  74/82 [=========================>--]  90%
#15 9.577  79/82 [==========================>-]  96%
#15 10.59  80/82 [===========================>]  97%
#15 11.69  81/82 [===========================>]  98%
#15 12.38  82/82 [============================] 100%
#15 12.38   - Installing vlucas/phpdotenv (v1.1.1): Extracting archive
#15 12.38   - Installing symfony/var-dumper (v2.7.36): Extracting archive
#15 12.39   - Installing symfony/translation (v2.7.36): Extracting archive
#15 12.39   - Installing symfony/routing (v2.7.36): Extracting archive
#15 12.39   - Installing symfony/process (v2.7.36): Extracting archive
#15 12.39   - Installing symfony/polyfill-mbstring (v1.6.0): Extracting archive
#15 12.40   - Installing symfony/http-foundation (v2.7.36): Extracting archive
#15 12.40   - Installing symfony/event-dispatcher (v2.8.29): Extracting archive
#15 12.40   - Installing psr/log (1.0.2): Extracting archive
#15 12.40   - Installing symfony/debug (v2.7.36): Extracting archive
#15 12.41   - Installing symfony/http-kernel (v2.7.36): Extracting archive
#15 12.41   - Installing symfony/finder (v2.7.36): Extracting archive
#15 12.41   - Installing symfony/dom-crawler (v2.7.36): Extracting archive
#15 12.41   - Installing symfony/css-selector (v2.8.29): Extracting archive
#15 12.41   - Installing symfony/console (v2.7.36): Extracting archive
#15 12.41   - Installing swiftmailer/swiftmailer (v5.4.8): Extracting archive
#15 12.41   - Installing nikic/php-parser (v2.1.1): Extracting archive
#15 12.41   - Installing jakub-onderka/php-console-color (0.1): Extracting archive
#15 12.41   - Installing jakub-onderka/php-console-highlighter (v0.3.2): Extracting archive
#15 12.41   - Installing dnoegel/php-xdg-base-dir (0.1): Extracting archive
#15 12.41   - Installing psy/psysh (v0.7.2): Extracting archive
#15 12.41   - Installing paragonie/random_compat (v1.4.2): Extracting archive
#15 12.41   - Installing nesbot/carbon (1.22.1): Extracting archive
#15 12.41   - Installing mtdowling/cron-expression (v1.2.1): Extracting archive
#15 12.41   - Installing monolog/monolog (1.23.0): Extracting archive
#15 12.42   - Installing league/flysystem (1.0.41): Extracting archive
#15 12.42   - Installing symfony/polyfill-util (v1.6.0): Extracting archive
#15 12.42   - Installing symfony/polyfill-php56 (v1.6.0): Extracting archive
#15 12.42   - Installing jeremeamia/SuperClosure (2.3.0): Extracting archive
#15 12.42   - Installing doctrine/inflector (v1.1.0): Extracting archive
#15 12.42   - Installing danielstjules/stringy (1.10.0): Extracting archive
#15 12.42   - Installing classpreloader/classpreloader (3.1.0): Extracting archive
#15 12.42   - Installing laravel/framework (v5.1.46): Extracting archive
#15 12.42   - Installing phenx/php-font-lib (0.2.2): Extracting archive
#15 12.42   - Installing dompdf/dompdf (v0.6.2): Extracting archive
#15 12.42   - Installing barryvdh/laravel-dompdf (v0.6.1): Extracting archive
#15 12.42   - Installing caffeinated/modules (v2.2.4): Extracting archive
#15 12.42   - Installing daniel-zahariev/php-aws-ses (0.8.9): Extracting archive
#15 12.42   - Installing fzaninotto/faker (v1.7.1): Extracting archive
#15 12.42   - Installing psr/http-message (1.0.1): Extracting archive
#15 12.42   - Installing guzzlehttp/psr7 (1.4.2): Extracting archive
#15 12.42   - Installing guzzlehttp/promises (v1.3.1): Extracting archive
#15 12.42   - Installing guzzlehttp/guzzle (6.3.0): Extracting archive
#15 12.42   - Installing hashids/hashids (1.0.6): Extracting archive
#15 12.42   - Installing intervention/image (2.4.1): Extracting archive
#15 12.42   - Installing ipunkt/laravel-analytics (1.3.5): Extracting archive
#15 12.42   - Installing ixudra/curl (6.15.1): Extracting archive
#15 12.42   - Installing mtdowling/jmespath.php (2.4.0): Extracting archive
#15 12.42   - Installing aws/aws-sdk-php (dev-master 9f70427): Extracting archive
#15 12.42   - Installing league/flysystem-aws-s3-v3 (1.0.23): Extracting archive
#15 12.42   - Installing tijsverkoyen/css-to-inline-styles (1.5.5): Extracting archive
#15 12.42   - Installing phpoffice/phpexcel (1.8.1): Extracting archive
#15 12.42   - Installing maatwebsite/excel (v2.0.10): Extracting archive
#15 12.43   - Installing hamcrest/hamcrest-php (v1.2.2): Extracting archive
#15 12.43   - Installing mockery/mockery (0.9.9): Extracting archive
#15 12.43   - Installing webmozart/assert (1.2.0): Extracting archive
#15 12.43   - Installing phpdocumentor/reflection-common (1.0.1): Extracting archive
#15 12.43   - Installing phpdocumentor/type-resolver (0.3.0): Extracting archive
#15 12.43   - Installing phpdocumentor/reflection-docblock (3.2.2): Extracting archive
#15 12.43   - Installing symfony/yaml (v3.3.11): Extracting archive
#15 12.43   - Installing sebastian/recursion-context (1.0.5): Extracting archive
#15 12.43   - Installing sebastian/exporter (1.2.2): Extracting archive
#15 12.43   - Installing sebastian/diff (1.4.3): Extracting archive
#15 12.43   - Installing sebastian/comparator (1.2.4): Extracting archive
#15 12.43   - Installing doctrine/instantiator (1.0.5): Extracting archive
#15 12.43   - Installing phpspec/prophecy (v1.7.2): Extracting archive
#15 12.43   - Installing phpspec/php-diff (v1.0.2): Extracting archive
#15 12.43   - Installing phpspec/phpspec (2.5.8): Extracting archive
#15 12.43   - Installing phpunit/php-token-stream (1.4.11): Extracting archive
#15 12.43   - Installing sebastian/version (1.0.6): Extracting archive
#15 12.43   - Installing sebastian/global-state (1.1.1): Extracting archive
#15 12.43   - Installing sebastian/environment (1.3.8): Extracting archive
#15 12.43   - Installing phpunit/php-text-template (1.2.1): Extracting archive
#15 12.43   - Installing phpunit/phpunit-mock-objects (2.3.8): Extracting archive
#15 12.43   - Installing phpunit/php-timer (1.0.9): Extracting archive
#15 12.43   - Installing phpunit/php-file-iterator (1.4.2): Extracting archive
#15 12.43   - Installing phpunit/php-code-coverage (2.2.4): Extracting archive
#15 12.43   - Installing phpunit/phpunit (4.8.36): Extracting archive
#15 12.43   - Installing predis/predis (v1.1.6): Extracting archive
#15 12.43   - Installing sarav/laravel-multiauth (0.0.5): Extracting archive
#15 12.43   - Installing bacon/bacon-qr-code (1.0.3): Extracting archive
#15 12.44   - Installing simplesoftwareio/simple-qrcode (1.5.1): Extracting archive
#15 12.45   0/82 [>---------------------------]   0%
#15 12.57  27/82 [=========>------------------]  32%
#15 12.68  43/82 [==============>-------------]  52%
#15 12.80  53/82 [==================>---------]  64%
#15 12.90  71/82 [========================>---]  86%
#15 12.95  82/82 [============================] 100%
#15 13.21 Generating autoload files
#15 13.29 1 package you are using is looking for funding.
#15 13.29 Use the `composer fund` command to find out more!
#15 13.33 > php artisan clear-compiled
#15 13.41 > php artisan optimize
#15 13.46 Generating optimized class loader
#15 14.60 Compiling common classes
#15 14.70 
#15 14.70                                                                                
#15 14.70   [ErrorException]                                                             
#15 14.70   Invalid characters passed for attempted conversion, these have been ignored  
#15 14.70                                                                                
#15 14.70 
#15 14.71 Script php artisan optimize handling the post-install-cmd event returned with error code 1
------

my Dockerfile:

FROM php:7.4.3-cli

# Install system dependencies
RUN apt-get update && apt-get install -y \
    git \
    curl \
    libpng-dev \
    libonig-dev \
    libxml2-dev \
    zip \
    unzip

# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd

COPY --from=composer:2.4.4 /usr/bin/composer /usr/local/bin/composer

# Set working directory
WORKDIR /app
COPY . . 
RUN composer install
alcohol commented 1 year ago

Not a container issue.