1

我们有一个 PHP - Symfony 项目,我们想在 Google Cloud App Engine Standard 上运行,但gcloud app deploy app.yml由于构建失败,我们无法使用它来部署应用程序。

应用程序.yml

runtime: php
service: "papi-dev"
instance_class: F2
env_variables:
  APP_ENV: prod
  APP_DEBUG: true
  DATABASE_URL: mysql://p...
runtime_config:
  document_root: ./public
  front_controller_file: index.php
  enable_stackdriver_integration: true
handlers:
# Declare the build and bundles directory as static assets to be served by the
# App Engine CDN.
- url: /build
  static_dir: public/build

作曲家.json

{
    "type": "project",
    "license": "proprietary",
    "require": {
        "php": "7.2.*",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "ext-json": "*",
        "api-platform/api-pack": "^1.1",
        "doctrine/doctrine-fixtures-bundle": "^3.0",
        "friendsofsymfony/elastica-bundle": "^5.0",
        "friendsofsymfony/oauth-server-bundle": "^1.6",
        "friendsofsymfony/user-bundle": "^2.1",
        "google/apiclient": "^2.0",
        "google/cloud-error-reporting": "^0.12.1",
        "google/cloud-logging": "^1.14",
        "guzzlehttp/guzzle": "~6.0",
        "jms/serializer-bundle": "^2.4",
        "lexik/jwt-authentication-bundle": "^2.5",
        "nelmio/cors-bundle": "^1.5",
        "pear/net_dns2": "^1.4",
        "productsupcom/jenkins-php-api": "^0.1.4",
        "sendgrid/sendgrid": "^7.2",
        "sensio/framework-extra-bundle": "^5.2",
        "symfony/console": "*",
        "symfony/dotenv": "*",
        "symfony/expression-language": "*",
        "symfony/flex": "^1.1",
        "symfony/framework-bundle": "*",
        "symfony/lock": "4.1.*",
        "symfony/maker-bundle": "^1.7",
        "symfony/monolog-bundle": "^3.3",
        "symfony/orm-pack": "^1.0",
        "symfony/proxy-manager-bridge": "*",
        "symfony/templating": "4.1.*",
        "symfony/translation": "4.2.*",
        "symfony/yaml": "*",
        "webonyx/graphql-php": "^0.12.6",
        "wisembly/elephant.io": "^3.3"
    },
    "require-dev": {
        "symfony/phpunit-bridge": "4.1.*"
    },
    "config": {
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "paragonie/random_compat": "2.*",
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php71": "*",
        "symfony/polyfill-php70": "*",
        "symfony/polyfill-php56": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "4.2.*"
        }
    }
}

生成器日志

Step #1 - "builder": INFO composer_update_lock composer update --lock
Step #1 - "builder": INFO `composer_update_lock` stdout:
Step #1 - "builder": 
Step #1 - "builder": Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 9437184 bytes) in phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php on line 565
Step #1 - "builder": 
Step #1 - "builder": Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.
Step #1 - "builder": INFO `composer_update_lock` had stderr output:
Step #1 - "builder": Do not run Composer as root/super user! See https://getcomposer.org/root for details
Step #1 - "builder": Loading composer repositories with package information
Step #1 - "builder": Updating dependencies (including require-dev)
Step #1 - "builder": Package operations: 128 installs, 0 updates, 0 removals
Step #1 - "builder": - Installing symfony/flex (v1.1.8): Downloading (connecting...)Downloading (0%) Downloading (20%)Downloading (25%)Downloading (45%)Downloading (60%)Downloading (65%)Downloading (75%)Downloading (80%)Downloading (90%)Downloading (95%)Downloading (100%)
Step #1 - "builder": 
Step #1 - "builder": ERROR error: `composer_update_lock` returned code: 255

在我们向 composer.json 添加更多包之前,部署命令一直有效。到目前为止,我最好的猜测是构建停止工作,因为这个 github 提交到云构建器映像,该映像composer update --lock在每次部署/构建执行时执行。

4

1 回答 1

0

由 Google 解决 - 调用 composer install 而不是 composer update。

于 2019-03-15T12:46:37.977 回答