Composer package versions conflict

I'm doing a laravel project using docker on php 7.3. But when I installed laravel/passport my docker container exits with code 255 with this error when I try to type docker-compose up:

Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.4.0". You are running 7.3.29. in /app/vendor/composer/platform_check.php on line 24

I've tried to change my php version to 7.4 in my Dockerfile and composer.json, but nothing changes

Dockerfile:

FROM php:7.4

RUN apt-get update -y && apt-get install -y openssl zip unzip git
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN docker-php-ext-install pdo mbstring pdo_mysql

WORKDIR /app
COPY . .
RUN composer install

CMD php artisan serve --host=0.0.0.0
EXPOSE 8000

composer.json:

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "php": "^7.4",
        "fideloper/proxy": "^4.4",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^7.0.1",
        "laravel/framework": "^8.40",
        "laravel/passport": "^10.1",
        "laravel/tinker": "^2.5"
    },
    "require-dev": {
        "barryvdh/laravel-ide-helper": "^2.10",
        "facade/ignition": "^2.5",
        "fakerphp/faker": "^1.9.1",
        "laravel/sail": "^1.0.1",
        "mockery/mockery": "^1.4.2",
        "nunomaduro/collision": "^5.0",
        "phpunit/phpunit": "^9.3.3"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

After docker-compose up --build:

#7 6.389 configure: error: Package requirements (oniguruma) were not met:
#7 6.389
#7 6.389 No package 'oniguruma' found
#7 6.389
#7 6.389 Consider adjusting the PKG_CONFIG_PATH environment variable if you
#7 6.389 installed software in a non-standard prefix.
#7 6.389
#7 6.389 Alternatively, you may set the environment variables ONIG_CFLAGS
#7 6.389 and ONIG_LIBS to avoid the need to call pkg-config.
#7 6.389 See the pkg-config man page for more details.
#7 ERROR: executor failed running [/bin/sh -c docker-php-ext-install pdo mbstring pdo_mysql]: exit code: 1
------
 > [4/7] RUN docker-php-ext-install pdo mbstring pdo_mysql:
------
executor failed running [/bin/sh -c docker-php-ext-install pdo mbstring pdo_mysql]: exit code: 1
Service 'backend' failed to build : Build failed

Answers 2

Related Articles