Развертывание Laradock в Google App Engine не работает

Я пытаюсь развернуть свой новый проект Laravel в Google App Engine, однако он не говорит: «Отсутствует расширение PHP bcmath». Я использую Laradock, поэтому мой проект может работать в контейнере Docker.

Вот конец журнала Google Cloud:

Step #1: INFO[0000] Removing ignored files from build context: [.dockerignore Dockerfile .git .hg .svn *~ .\#* app.yaml] 
Step #1: INFO[0001] Downloading base image gcr.io/google-appengine/php72@sha256:0f0d6c07035fd5138d917b4d539f4473ca13528f11c26c92be54b9e33c0f722b 
Step #1: INFO[0013] Taking snapshot of full filesystem... 
Step #1: INFO[0020] ENV DOCUMENT_ROOT='/app/public' APP_LOG='errorlog' APP_KEY='base64:ak4/ZLdvSpRF3JDRPuR8mgzzGB8GXGuLVF/PP8qnTH4=' STORAGE_DIR='/tmp' FRONT_CONTROLLER_FILE='index.php' COMPOSER_FLAGS='--no-dev --prefer-dist' DETECTED_PHP_VERSION='7.2' 
Step #1: INFO[0020] Using files from context: [/workspace] 
Step #1: INFO[0020] COPY . $APP_DIR 
Step #1: INFO[0022] Taking snapshot of files... 
Step #1: INFO[0024] RUN chown -R www-data.www-data $APP_DIR 
Step #1: INFO[0024] cmd: /bin/sh 
Step #1: INFO[0024] args: [-c chown -R www-data.www-data $APP_DIR] 
Step #1: INFO[0024] Taking snapshot of full filesystem... 
Step #1: INFO[0032] RUN /build-scripts/composer.sh 
Step #1: INFO[0032] cmd: /bin/sh 
Step #1: INFO[0032] args: [-c /build-scripts/composer.sh] 
Step #1: Using PHP version: 7.2
Step #1: Install PHP extensions...
Step #1: Running composer...
Step #1: Loading composer repositories with package information
Step #1: Installing dependencies from lock file
Step #1: Your requirements could not be resolved to an installable set of packages.
Step #1: 
Step #1: Problem 1
Step #1: - Installation request for moontoast/math 1.1.2 -> satisfiable by moontoast/math[1.1.2].
Step #1: - moontoast/math 1.1.2 requires ext-bcmath * -> the requested PHP extension bcmath is missing from your system.
Step #1: Problem 2
Step #1: - moontoast/math 1.1.2 requires ext-bcmath * -> the requested PHP extension bcmath is missing from your system.
Step #1: - laravel/telescope v1.0.10 requires moontoast/math ^1.1 -> satisfiable by moontoast/math[1.1.2].
Step #1: - Installation request for laravel/telescope v1.0.10 -> satisfiable by laravel/telescope[v1.0.10].
Step #1: 
Step #1: To enable extensions, verify that they are enabled in your .ini files:
Step #1: - /opt/php72/lib/php-cli.ini
Step #1: - /opt/php72/lib/ext.enabled/ext-apcu-bc.ini
Step #1: - /opt/php72/lib/ext.enabled/ext-mailparse.ini
Step #1: - /opt/php72/lib/ext.enabled/ext-memcached.ini
Step #1: You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Step #1: error building image: error building stage: waiting for process to exit: exit status 2
Finished Step #1
ERROR
ERROR: build step 1 "gcr.io/kaniko-project/executor@sha256:f87c11770a4d3ed33436508d206c584812cd656e6ed08eda1cff5c1ee44f5870" failed: exit status 1

Я попытался скопировать основной php.ini Ларадока в корневую папку проекта, но это не помогло. Надеюсь, кто-нибудь сможет мне помочь.


person Mike    schedule 14.01.2019    source источник


Ответы (1)


Что ж. После нескольких часов попыток перепробовать кучу разных вещей я опустошил голову, снова сел и начал с самого начала. Именно тогда я понял, насколько я был глуп.

Во всяком случае, расширение bcmath отсутствовало. Я думал, что где-то читал, что по умолчанию расширение bcmath было включено в среде выполнения PHP Google App Engine. Это был не тот случай.

Итак, после медленного прочтения этого https://cloud.google.com/appengine/docs/flexible/php/runtime Я понял, что все, что мне нужно сделать, это включить расширение bcmath в моем composer.json, поскольку Google Cloud читает из этого файла.

"name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": "^7.1.3",
        "fideloper/proxy": "^4.0",
        "laravel/framework": "5.7.*",
        "laravel/telescope": "^1.0",
        "laravel/tinker": "^1.0",
        "ext-bcmath": "*"
    },

Я добавил «ext-bcmath», развернул приложение, и оно заработало!

person Mike    schedule 15.01.2019