Laradock在Google App Engine上的部署无法正常工作

时间:2019-01-14 15:14:35

标签: laravel google-app-engine google-cloud-platform laradock

我正在尝试将新的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

我尝试将Laradock的主要php.ini复制到根项目文件夹,但这没有帮助。希望有人可以帮助我。

1 个答案:

答案 0 :(得分:1)

好吧。经过数小时的尝试,我排空了头,再次坐下,从头开始。那时我意识到自己一直很愚蠢。

无论如何,扩展名bcmath丢失了。我以为我读过某个地方,默认情况下,bcmath扩展名在Google App Engine的PHP运行时中处于打开状态。事实并非如此。

因此,在慢慢阅读此https://cloud.google.com/appengine/docs/flexible/php/runtime之后,我发现我需要做的就是在Google Cloud从该文件读取时在composer.json中启用bcmath扩展名。

"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”,部署了该应用程序,它开始工作了!

相关问题